Browser Automation integration

Browser Automation integration

The Browser Automation integration opens a website on a schedule, takes a screenshot of it, and makes that screenshot available to the Browser Automation app on your screens. It can show public pages, and it can sign in to pages that need a username and password, such as a dashboard, a booking overview or a status page.

You tell the integration where things are on the page, for example the cookie button, the username field and the login button. You do this with CSS selectors, which are short addresses that point to one specific element on a web page. The section How to find a CSS selector further down shows you exactly how to find them, step by step.

Before you start, see Working with integrations in Q-Play if you haven't set up an integration before.


What you need

  • The address (link) of the page you want to show.
  • If the page needs a login: a username and password for an account that can see the page. Use a dedicated account that can only see what should be shown on screen, not a personal one.
  • A computer with Google Chrome or Microsoft Edge, so you can find the CSS selectors.

What the integration can't do

Check this list before you start, so you don't spend time on a site that won't work.

  • Accounts with two-factor authentication (codes by SMS, authenticator app and similar) can't be used.
  • Login pages with a captcha ("I'm not a robot") can't be used.
  • "Sign in with Microsoft" or "Sign in with Google" buttons that send you to another site to log in are not supported. Only plain login forms on the site itself work. Logins where you type the username, click Next, and then type the password on a second screen do work.
  • Login forms placed inside an embedded frame (an iframe) are not supported. The section Elements inside a frame or shadow root explains how to spot this.
  • Sites that block automated browsers, for example with a "Checking your browser" page from Cloudflare, will not work.
  • The integration signs in again every time it takes a screenshot. Some sites limit how often you can sign in, or flag frequent logins as suspicious. If that's a concern, choose a less frequent schedule in step 13.

1. Set up the integration

Create a new Browser Automation integration and fill in:

  • Name: a name that tells you what the integration is for, for example "Browser Automation - Reception".
  • Timezone: the time zone the browser uses when it opens the website, for example Europe/Copenhagen. Websites that show times and dates use this time zone, so choose the one where your screens are. If you don't, the screenshot may show the wrong time.


All the settings for the website itself are made on a job. One integration can hold many jobs, so you can add one job per website, page or account, each with its own login.


2. Add a job

Add a new screenshot job to the integration. Give it a name that tells you which page it shows, for example "Sales dashboard". You will pick this job in the app later.



3. Choose whether to sign in

In "Sign in to the website?", choose:

  • Yes (the default) if the page needs a login.
  • No, the page is public if anyone can open the page without logging in. With this option, the sign-in settings in steps 6 and 7 are hidden.

In "Website link", enter the address the integration should open first.

  • If you're signing in, enter the address of the page with the login form, or the page with the button that opens the login form.
  • If the page is public, enter the address of the page you want to show.

Open the page in your browser and copy the address from the address bar.



Most websites show a cookie banner the first time you visit. The integration visits the site as a new visitor every time, so it sees the banner on every run. In "Cookie banner?", choose:

  • Close it automatically (the default) handles the most common cookie banners for you: Cookiebot, OneTrust, Cookie Information, Didomi, Sourcepoint, Usercentrics, CookieYes, Complianz, Quantcast, TrustArc and CookieScript. You don't need a selector. Start with this option.
  • Close it by clicking a button I choose clicks a button you point out. Use this if the cookie banner is still in the screenshot with the automatic option, which means the site has its own banner. Enter the selector of the button that closes the banner in "Cookie banner button selector".
  • Remove a banner I choose from the page removes the banner without clicking anything. Use this if clicking a button doesn't work either, which means the banner is drawn inside a frame where buttons can't be clicked. Enter the selector of the banner's outer box in "Cookie banner selector".
  • No banner if the site doesn't show a cookie banner.

If the banner doesn't appear on a run, this step is skipped and the run continues. The integration also checks for the banner one more time just before it takes the screenshot, so banners that show up late are caught too.


To find out whether a banner is inside a frame, see Elements inside a frame or shadow root under How to find a CSS selector.


6. Fill in the sign-in details

Skip this step if you chose No, the page is public in step 3.

Fill in the fields below. Each selector field needs the CSS selector of one element on the login page. See How to find a CSS selector for how to find each one, and Which element to pick for each field for exactly which element to inspect.

  • Click a button to show the login form first?: choose Yes if the page shows a "Log in" or "Click here to sign in" button or link before the username and password fields appear. Then enter the selector of that button or link in "'Show login' button selector". If the username and password fields are visible straight away, leave it at No.
  • Username or email: the account the screen signs in with.
  • Password: the password for that account.
  • Login form type: choose Username and password on the same page (the default) if both fields are on one screen. Choose Username first, then 'Next', then password if the site asks for the username, and only shows the password field after you click Next. With the second option, the "'Next' button selector" field appears.
  • Username field selector: the selector of the field where you type the username or email.
  • 'Next' button selector: only for the two-step login form type. The selector of the button that takes you from the username to the password.
  • Password field selector: the selector of the password field.
  • Login button selector: the selector of the button that signs in.

After clicking the login button, the integration waits 5 seconds for the site to sign in.


7. Choose which page to show after signing in

Skip this step if you chose No, the page is public in step 3.

In "After signing in", choose:

  • Show the page the login lands on (the default). Most sites send you to their start page after signing in. Use this if that's the page you want on screen.
  • Open another page if the page you want on screen is somewhere else, for example a specific report or dashboard. Enter its address in "Page to show". To find the address, sign in to the site in your browser, go to the page you want on screen, and copy the address from the address bar.

8. Choose an element to wait for

In "Wait for element", enter the selector of an element on the page you want on screen. The integration waits until this element appears before it takes the screenshot. If it never appears, the run fails and the previous screenshot stays on screen.

The default is body, which waits for any page. That works, but it doesn't tell the integration whether the right page has loaded. A better choice is something that is part of the content you care about, for example the main chart or the table of bookings.

If you're signing in, pick an element that only shows when you're signed in, for example your account menu. That way, if the login fails, the run fails instead of showing a screenshot of the login page.


9. Choose what to show

In "What to show", choose which part of the page ends up in the screenshot:

  • Top of the page (the default) shows the top of the page, exactly as it looks when the page opens.
  • One element only (cropped to it) shows one part of the page only, for example a single chart or table. The screenshot is cropped to that element. Enter its selector in "Element selector".
  • Area around an element (element in the middle) scrolls so that an element is in the middle of the screenshot, with the rest of the page around it. Enter its selector in "Element selector".
  • Fixed position (only for pages whose layout never changes) scrolls to a fixed spot on the page. It always shows the same pixels, so it shows the wrong part if the page's content moves. In most cases, Area around an element is the better choice.

One element only and Area around an element follow the element when the page's content changes, so they keep showing the right part.


With Area around an element and Fixed position, two more fields appear:

  • Move right (pixels): with Area around an element, moves the view this many pixels to the right of the centred element. Use a negative number, for example -200, to move left. With Fixed position, it's how far from the page's left edge the view starts.
  • Move down (pixels): with Area around an element, moves the view this many pixels below the centred element. Use a negative number to move up. With Fixed position, it's how far from the top of the page the view starts.

Both are 0 by default.


10. Set the image size

In "Image width" and "Image height", enter the size of the screenshot in pixels. The default is 1920 × 1080, which fits a 16:9 screen. For a 9:16 (portrait) screen, use 1080 × 1920.

Anything below the image height on the page is not included in the screenshot.


11. Set the zoom

In "Zoom", choose from 50% to 150%. The default is 100%. Zoom out to fit a long page into the screenshot, or zoom in to make a small page easier to read from a distance.


12. Set the wait before the screenshot

In "Wait before screenshot", choose how long the integration waits before it takes the screenshot: 2, 5, 10, 20 or 30 seconds. The default is 5 seconds. This gives the page time to finish loading its content and charts. If the screenshot shows loading spinners or blank areas, choose a longer wait.


13. Set the refresh schedule

In "Refresh schedule", choose how often a new screenshot is taken: Every 15 min, Every 30 min or Every hour. The default is Every 30 min. "Schedule type" only has one option, Scheduled, so you can leave it as it is.

If you're signing in, the integration signs in again on every run.


14. Save and check the result

Save the job, and run it manually the first time. After that, it runs on the refresh schedule. See Working with integrations in Q-Play for how to run a job.

If a run fails, check the job's log. See Working with integrations in Q-Play for how to find it. A line starting with "Waiting for" shows which selector could not be found. Find that selector again with the steps below, correct it, and save.

When the job has taken its first screenshot, add the Browser Automation app to a slide to show it on your screens. See Browser Automation app.


How to find a CSS selector

A CSS selector is a short piece of text that points to one specific element on a web page, such as a field, a button or a box. You find it with the developer tools that are built into Google Chrome and Microsoft Edge. The steps are the same in both browsers. You don't need to change anything on the website and you don't need to know how to code.

Step 1: Open the page in a private window

Open a private window: in Chrome it's called an Incognito window, in Edge it's called an InPrivate window. Press Ctrl+Shift+N on Windows or Cmd+Shift+N on Mac.

Go to the page in the private window. The integration always visits as a brand new visitor who is not logged in, and a private window shows you the page the same way, with the cookie banner and the login form.


Step 2: Right-click the element and choose Inspect

Right-click the exact element you need a selector for, for example inside the username field, and choose Inspect. In Edge the menu item may be called Inspect or Inspect element.

The developer tools open next to the page. In the Elements panel, one line of the page's code is highlighted. That line is the element you right-clicked.


Tip: If the highlighted line isn't the element you meant, hover over the lines just above and below it. The browser highlights the matching element on the page as you hover, so you can see which line belongs to which element. You can also click the arrow icon in the top-left corner of the developer tools and then click the element on the page to select it.


Step 3: Copy the selector

Right-click the highlighted line in the Elements panel and choose Copy, then Copy selector. The selector is now on your clipboard, ready to paste into the integration.

Do not use Copy XPath or Copy full XPath. The integration only accepts CSS selectors.

If the copied selector is very long, see If the copied selector is long or doesn't work below.



If the copied selector is long or doesn't work

Copy selector often gives a short selector like #username, which is what you want. Sometimes it gives a long one, like #root > div > div:nth-child(3) > form > div:nth-child(2) > input. A long selector like that describes the exact position of the element, so it breaks as soon as the site moves something around.

In that case, look at the highlighted line in the Elements panel and write a short selector yourself from what it says:

  • If it has id="something", the selector is #something.
  • If it has name="something", the selector is input[name="something"] (or button instead of input, if the line starts with button).
  • For the password field, input[type="password"] works on most sites. For the login button, button[type="submit"] works on most sites.

Avoid ids and classes that look random, for example id="input-8f3a2c" or class="css-1x2y3z". They usually change when the page loads again, and the selector stops working.

Here are some typical examples:

WhatExample of the highlighted lineSelector
Username fieldinput id="username"#username
Username fieldinput type="email" name="email"input[name="email"]
'Next' buttonbutton id="next-step"#next-step
Password fieldinput type="password" name="pwd"input[type="password"]
Login buttonbutton type="submit" class="btn login-btn"button[type="submit"]
Cookie banner buttonbutton id="accept-cookies"#accept-cookies
Cookie banner buttonbutton data-action="accept"button[data-action="accept"]


Elements that only appear after a click

Some elements are not on the page until you do something. For example, the password field on a two-step login only appears after you type the username and click Next, and a login form might only appear after you click a "Log in" button.

To find the selector for those, go through the steps by hand in your private window until the element is visible, then right-click it and choose Inspect as usual.


Elements inside a frame or shadow root

Sometimes an element sits inside a separate, embedded part of the page. You can spot this in the Elements panel when you see one of these a few lines above the highlighted line:

  • iframe, followed by #document
  • #shadow-root

The integration can't click or type inside these.

  • If it's the cookie banner, set "Cookie banner?" to Remove a banner I choose from the page, and use the selector of the iframe line itself, or of the box around it, as the "Cookie banner selector".
  • If it's the login form, the site can't be used with this integration.

Which element to pick for each field

FieldPick this element
Cookie banner button selectorThe button that closes the cookie banner, not the text next to it.
Cookie banner selectorThe outer box of the whole banner, including the dark backdrop behind it. Click upwards in the Elements panel, one line at a time, until the whole banner and backdrop are highlighted on the page.
'Show login' button selectorThe button or link you click to show the login form.
Username field selectorThe field you type the username or email in, not its label.
'Next' button selectorThe button that takes you from the username to the password.
Password field selectorThe field you type the password in.
Login button selectorThe button that signs in.
Wait for elementSomething on the page you want on screen. When signing in, something that only shows when you're signed in, for example your account menu.
Element selectorThe box around the part of the page you want to show, for example a chart, table or box. Click upwards in the Elements panel until the whole part is highlighted on the page.


Troubleshooting

  • The screenshot still shows the cookie banner: change "Cookie banner?" to Close it by clicking a button I choose. If that doesn't work either, use Remove a banner I choose from the page.
  • The screenshot shows the login page: one of the sign-in selectors is wrong, or the username or password is wrong. Check the log to see which step failed. Also make sure your "Wait for element" is something that only shows when you're signed in.
  • The run fails at a "Waiting for" line: the selector in that step finds nothing. Copy the selector again in a private window, and check that the element is visible at that point in the flow.
  • The screenshot shows loading spinners or blank areas: choose a longer "Wait before screenshot".
  • The view is in the wrong place: use Area around an element instead of Fixed position, and adjust Move right and Move down.
  • The bottom of the page is missing: increase "Image height", or zoom out.
  • The screen shows an old screenshot: the latest run failed, so the screen keeps the previous screenshot. Check the log.