Tips and tricks Best practice guides, FAQ & more
A Use Browser Window building block is used to switch focus to a specific web browser window when working with web automation. Please note that this block only works with browser windows that were previously opened using the Start Web Browser block. Please also note that multiple browser windows are not supported by Selenium Grid or external cloud providers such as Sauce Labs and BrowserStack.
Fully expanded, the Use Browser Window block shows the following properties:
The green input connector in the header is used to trigger the block to start executing.
The green output connector in the header triggers when the desired web browser window has been found and focus has been set on it.
The title of the block (“Use Browser Window”) can be changed by double-clicking on it and typing in a new title.
Select which method to use to find the desired web browser window. There are three available options:
By page title. This will attempt to find a window based on the window’s loaded page’s title.
By page URL. This will attempt to find a window based on the window’s loaded page’s URL.
By page content. This will attempt to find a window based on the window’s loaded page’s content.
After selecting the method, a condition and text to find must be set (see below).
Select what condition to use when attempting to find the desired browser window by either title, URL or page content. The condition options are:
Equals. This will attempt to find a window where there is an exact match between the title, URL or page content and the text entered below.
Contains. This will attempt to find a window where the text entered below is contained in the title, URL or page content.
Starts with. This will attempt to find a window where the title, URL or page content starts with the text entered below.
The text to be used to find the desired window. Can contain tokens for field values (added below).
Right-click and select “Insert token” to insert one or more field tokens.
Fields that enable the use of external values in the text to find.
To use the value of an added field, right-click the text field above where the text can be entered and select “Insert token” and then insert this field’s name.
Fields can be renamed by double-clicking on them. The tokens will change their visual appearance accordingly.
Add a field to be used in the text.
Once a browser window is found and focus is set, this property contains a handle to the window. This can be used in cases where multiple browser windows are opened during a case run, to direct other building blocks to use a specific window. Multiple browser windows are not supported by Selenium Grid or external cloud providers such as Sauce Labs and BrowserStack.
This green output connector triggers if the browser window is not found before the timeout (see below). This is typically used to branch execution flow or to explicitly fail a case by linking it to a Fail block.
Select which occurrence of the browser window to use, if more than one is found that matches the criteria (above).
Select “All” to iterate through all of the occurrences. By selecting “All”, the sub-properties Current index and Completed are shown (see below).
The current index when iterating through all occurrences of the matching browser windows.
This green output connector triggers when the iteration of all occurrences are completed.
If the 'Default Timeout' property checkbox is not selected, then the timeout value is 10 seconds. If the 'Default Timeout' property checkbox is selected, then the 'Default timeout' value selected in the flow settings will be applicable.
The maximum time spent for finding and setting focus on the browser window before giving up and triggering “Not found” (see above).
Note: All cases have a “global timeout” that can be configured in the “Settings” panel. This is unrelated to the timeout of a single building block. However, a running case will automatically be cancelled if it runs for longer than the global timeout.
©2023, LEAPWORK. All rights reserved. Legal