Open Browser Version 28 (Java)

Action group: Browsers


Description

This action is intended to open the selected browser. A context is created when the browser is opened.

Action icon

Action parameters

Input parameters

Browser                                     The browser to be opened

Properties                                  A list of browser properties and their values that will be set when the browser is launched

Explicitly wait                             The time to wait for the properties of individual elements to change

Background mode                     Opens in invisible mode. Internet Explorer does not support this setting

URL                                             The URL that should be navigated to when the browser is opened

Save in                                         The path to the folder where files should be saved when downloaded

Output parameters

Context The context of the open browser session that will be accessed by further actions

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Browser

Browser selection

Default is Chrome


Dropdown list:

  • Chrome
  • Yandex
  • Firefox
  • Internet Explorer
  • Edge (chromium)
Robin.StringChromeNo
PropertiesList of browser properties and their values ​​that will be set when the browser starts

In JSON format, describing a list of browser properties and their values to be set at launch

If the parameter is populated, its values take precedence over the values of the other fields

You can connect extensions and set the profile through this parameter

Robin.StringJSON по шаблонуNo
Explicitly waitTime to wait for changes in the properties of individual elements

Specifies a waiting time limit value to be used by default in group actions, determining the time to access items

Measured in milliseconds

Robin.Numeric10000No
Background modeBackground mode
Internet Explorer does not support this setting (вопрос)
Robin.BooleantrueNo
URLURL to be navigated after opening the browserRobin.Stringhttps://google.com/No
Save inPath to folder to save filesRobin.FolderPathC:\doc\imgNo
Results
ContextThe browser instance that Selenium will work with
Browser instance with which Selenium will work
Robin.SeleniumBrowser context

Special conditions of use 

Example of filling in the "Properties" field (filled in automatically by recording actions in Recorder). 

{"acceptInsecureCerts":true,
"browserName":"chrome",
"goog: loggingPrefs":{"browser":"ALL"},
"timeouts":{"implicit":0,"pageLoad":300003,"script":30003},
"unhandledPromptBehavior":"dismiss",
"goog:chromeOptions":{"args":["disable-popup-blocking","disable-notifications","no-sandbox"],"extensions":[]}}

The browser properties look something like the following:

{"acceptInsecureCerts":true,
"browserName":"chrome",
"goog: loggingPrefs":{"browser":"ALL"},
"timeouts":{"implicit":0,"pageLoad":300003,"script":30003},
"unhandledPromptBehavior":"dismiss",
"goog:chromeOptions":{"args":["disable-popup-blocking","disable-notifications","no-sandbox","--disable-blink-features=AutomationControlled"],"extensions":[]}}


Note: In folder/file paths, the backslash must be escaped (C:\\Users\\User or C:/Users/User ). 

Most of the features are available through the ChromeOptions object (highlighted in bold in the properties). It is used to control various properties of the browser driver. Therefore, we are more interested in this object.

Denoted as follows:

"goog:chromeOptions":{"Option 1": Value 1, "Option 2": Value 2}.

Option values can be of the following types:

  • String - "text"
  • List of strings - ["text1", "text2"]
  • Dictionary - {"key1": "value1", "key2": "value2"}
  • Boolean type - false/true

In the example, at the very beginning of the text, the options "args" and "extensions" are used. The entire list of options of the ChromeOptions object is shown in the table. The most frequently used options are highlighted in green.

Option name

Type

By default

Option description  

args 

List of strings


A list of command line arguments used when launching Chrome. Arguments with a related value must be separated by a sign '=' (for example, ‘args’ : ['start-maximized', 'user-data-dir=C:/Users/User/AppData/Local/Google/Chrome/User Data/Default']). A list of Chrome arguments is provided here.

binary

String


Path to the Chrome executable file to use

extensions

List of strings


A list of Chrome extensions to install on startup. Each item in the list must have a packaged Chrome extension in base-64 (.crx) encoding

Getting a crx extension

localState

Dictionary


A dictionary with each entry consisting of the name of the preference and its value. These settings are applied to the local state file in the user data folder.

prefs

Dictionary


A dictionary with each entry consisting of the name of the preference and its value. These preferences apply only to the user profile in use. For examples, see the "Preferences" file in the Chrome user data directory (C:\Users\{User}\AppData\Local\Google\Chrome\User Data\{GoogleUser}).

detach

Boolean type

false 

If false, Chrome will be closed when ChromeDriver is removed, regardless of whether the session is terminated. If the value is true, Chrome will only be closed if the session is completed (or closed). Note that if the value is true and the session is not terminated, ChromeDriver will not be able to clean up the temporary user data directory used by the running Chrome instance.

debuggerAddress

String


The address of the Chrome debugger server to connect to as <hostname/ip:port>, for example '127.0.0.1:38947'

excludeSwitches

List of strings


List Chrome command line switches to prevent ChromeDriver from being passed by default when Chrome starts. Specify switches without the prefix --.

minidumpPath 

String


A directory for storing Chrome mini-dumps (Supported on Linux only).

mobileEmulation

Dictionary


A dictionary with the value "deviceName" or values for "deviceMetrics" and "userAgent". See Mobile device emulation for more information. https://chromedriver.chromium.org/mobile-emulation

Example: "mobileEmulation": {"deviceName": "iPhone 12 Pro"}

windowTypes

List of strings


A list of window types to be displayed in the window descriptor list. To access <webview> elements, include "webview" in this list.

The Chrome/Yandex startup part of the properties looks like this:

{"goog:chromeOptions":{
   "args":[
    "-disable-blink-features=AutomationControlled",
    "disable-popup-blocking",
    "disable-notifications",
    "disable-infobars",
    "disable-gpu",
    "no-sandbox",
    "disable-extensions",
    "start maximized",
    "user-data-dir=C^//Users//robin_user//APPData//Local//Yandex//YandexBrowser//User Data",
    "profile-directory=Profile 1"
 ],
 "excludeSwitches":["enable-automation"],
 "extensions":[]
 }
}


PLEASE NOTE!

The string "excludeSwitches":["enable-automation"] allows you to disable checking for automated software control, and the"disable-extensions" argument blocks plugins from loading. 

The plugin loading process checks to see if the browser is running automated software.

In order to load a plugin, you must disable the check for automated software management and remove the "disable-extensions" argument.


It is possible that when a page is loaded, the page is visible to the user and can be interacted with, and the page continues to load. The robot stops and waits for the page to finish loading. In order for the robot to continue its work, it is necessary to forcibly cancel the loading.

To do this, you need to specify in the properties "pageLoadStrategy":

{"acceptInsecureCerts":true,"browserName":"chrome","goog: loggingPrefs":{"browser":"ALL"},"pageLoadStrategy": "eager",
"timeouts":{"implicit":0,"pageLoad":300003,"script":30003},
"unhandledPromptBehavior":"dismiss",
"goog:chromeOptions":{"args":["disable-popup-blocking","disable-notifications","no-sandbox"],"extensions":[]}}

Alternatively, you can specify "none" instead of "eager", but then there is a risk that the page will not load. The "eager" value only waits for the page DOM to load, without waiting for scripts, images and other resources to load, the "none" value does not wait at all.

Example of use

Task

Open the selected browser on the given page, get the action context for working with actions of the "Browsers" group.

Solution

Use the "Open Browser" action. 

Implementation

  1. Open the "Browsers" action group
  2. Open the "Windows, tabs, frames" subgroup 
  3. Add the "Open Browser" action to the workspace.
  4. Set the action parameters:
    1. "Browser" field. Select a browser from the drop-down list that you want to open. 
    2. "Properties" field. Specify a JSON-formatted file using a template that will set the prioritized properties to launch the browser. 
    3. "Explicitly wait" field. Set the timeout time to 1000ms.
    4. "Background mode" field. The value is "True" or "False". Leave "False" to open the browser in visible mode.  
    5. "URL" field. Specify the URL that will be used to open the browser - https://ya.ru
    6. The "Save in" field. Specify the address on the PC where the downloaded files will be saved if the download link is specified in the "Address" parameter.
  5. Add the "Close browser" action to the workspace. Fill in the "Context" parameter.
  6. Launch the robot using the "Start" button in the top panel.

Result

The Edge browser was opened in visible mode, and the page was navigated to https://ya.ru

  • Нет меток