Use Browser Window

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:

Use browser window block

The Block Header (“Use Browser Window”)

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.

Get window method

Select which method to use to find the desired web browser window. There are three available options:

  1. By page title. This will attempt to find a window based on the window’s loaded page’s title.
  2. By page URL. This will attempt to find a window based on the window’s loaded page’s URL.
  3. 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).

Condition

Select what condition to use when attempting to find the desired browser window by either title, URL or page content. The condition options are:

  1. 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.
  2. Contains. This will attempt to find a window where the text entered below is contained in the title, URL or page content.
  3. Starts with. This will attempt to find a window where the title, URL or page content starts with the text entered below.

Text to find

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.

Text fields

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 field

Add a field to be used in the text.

Browser window

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.

Not found

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.

Use Occurrence

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).

Current index

The current index when iterating through all occurrences of the matching browser windows.

Completed

This green output connector triggers when the iteration of all occurrences are completed.

Timeout

The maximum time spent for finding and setting focus on the browser window before giving up and triggering “Not found” (see above).

The default value is 10 seconds.

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.

Author: Claus Topholt, March 23, 2017.