Action group: Browsers
This action is intended to open the selected browser. A context is created when the browser is opened.
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
Context The context of the open browser session that will be accessed by further actions
Property | Description | Type | Filling example | Mandatory field |
---|---|---|---|---|
Parameters | ||||
Browser | Browser selection Default is Chrome Dropdown list:
| Robin.String | Chrome | No |
Properties | List 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.String | JSON по шаблону | No |
Explicitly wait | Time 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.Numeric | 10000 | No |
Background mode | Background mode Internet Explorer does not support this setting | Robin.Boolean | true | No |
URL | URL to be navigated after opening the browser | Robin.String | https://google.com/ | No |
Save in | Path to folder to save files | Robin.FolderPath | C:\doc\img | No |
Results | ||||
Context | The browser instance that Selenium will work with | Robin.Selenium | Browser context |
Example 1. 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:
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.
When performing the “Open Browser” action, if you use an encoding other than UTF-8 in the env.cfg file - for example, with Cyrillic characters - you may get a situation where if the driver is present, a message about its absence appears:
The action fails because the driver is not found.
The reason is a problem in the encoding of the env.cfg file. In our example, on a virtual host, the file was encoded in Windows-1251:
In order for the "Open Browser" action to work, you need to convert and resave the file in UTF-8 encoding:
The action will be started, and the robot will complete without an error. The browser will open.
This situation can be replicated with any folder that has Cyrillic letters in the path. At the same time, it is not necessary that the user himself be written in Cyrillic. |
Example of use
Open the selected browser on the given page, get the action context for working with actions of the "Browsers" group.
Use the "Open Browser" action.
The Edge browser was opened in visible mode, and the page was navigated to https://ya.ru