ACCELQ gives you the ability to customize web driver capabilities for your test execution, granting you control over the startup behavior of your browser. With ACCELQ, you have the option to create multiple web driver profiles, each designed for specific purposes. For instance, you may have one profile for running Chrome in headless mode and another profile for adjusting the size of the browser window. During test execution, simply choose the profile that fits your needs.
ACCELQ has undergone an upgrade to support the latest Selenium 4 browser capabilities, transitioning from the outdated legacy protocol to the widely adopted W3C WebDriver standard. With this enhancement, you now have the ability to configure browser capabilities for a broader range of browsers, including Chrome, Firefox, Edge, and Safari.
Create a Web Driver Profile
You can create a Web Driver Profile from the Resources tab in ACCELQ.
Provide a meaningful reference name and configuration text (JSON) as input. This document provides guidance on the JSON format for web driver configuration.
Capability |
Key |
Value Type |
Description |
Supported Browsers |
||||
Chrome |
Edge |
Firefox |
IE |
Safari |
||||
Browser version |
“browserVersion” |
string |
Indicates the browser version[To be used for Perfecto web automation only] |
|
||||
"acceptInsecureCerts" |
boolean |
Indicates whether untrusted and self-signed TLS certificates are implicitly trusted on navigation for the duration of the session. |
||||||
"pageLoadStrategy" |
string |
Defines the current session’s page load strategy. Valid values for this node are “NORMAL, EAGER, NONE. Defaults to NORMAL |
|
|||||
"proxy" |
JSON Object |
Defines the current session’s proxy configuration. |
|
|||||
"strictFileInteractability" |
boolean |
Defines the current session’s strict file intractability. |
||||||
"unhandledPromptBehavior" |
string |
Describes the current session’s user prompt handling. |
|
|
|
|||
"headless" |
boolean |
This is to execute the run in the background. You won't see the run browser on the screen |
|
|||||
"binary" |
String |
This allows you to point to the browser binary not installed in the default location |
|
|||||
"incognito" |
boolean |
This is to trigger runs in a private/incognito browser. |
||||||
"extensions" |
JSON Array |
This config will allow loading packaged extensions (CRX file for Chrome and XPI for Firefox) |
|
|||||
"args" |
JSON Array |
This config will allow you to pass arguments to the browser during initialization |
||||||
"prefs" |
JSON Object |
This will allow you to add browser preferences. These are the options that you typically set in Selenium using : ChromeOptions.setExperimentalOptions("prefs",Map<String,Object>) //Chrome (new FirefoxProfile()).setPreference() //Firefox
|
||||||
"browserCapabilities" |
JSON Object |
This option will allow setting any browser-specific capability that is usually set through browser options. (new ChromeOptions()).setExperimentalOption() //Chrome (new EdgeOptions()).setExperimentalOption() //Edge |
||||||
"cloudOptions" |
JSON Object |
This is used for setting remote execution host vendor-specific capabilities. |
|
Let's delve into each capability in detail and gain a deeper understanding of how to configure it.
Accept insecure TLS certificates (acceptInsecureCerts)
This option allows for the automatic trust of untrusted and self-signed TLS certificates during navigation for the current session.
{
"acceptInsecureCerts": true
}
Page load strategy (pageLoadStrategy)
The page load strategy queries the document.readyState as described in the table below:
Applicable values are:
- NORMAL (Default)
- EAGER
- NONE
Strategy |
Ready State |
Notes |
NORMAL |
complete |
Used by default, waits for all resources to download |
EAGER |
interactive |
DOM access is ready, but other resources like images may still be loading |
NONE |
Any |
Does not block WebDriver at all |
The document.readyState property of a document describes the loading state of the current document.
By default, when a user navigates to a new page using a URL, WebDriver will wait until the document is fully loaded (i.e., the ready state is complete) before completing the navigation. However, this does not necessarily mean that all content on the page has finished loading, especially for websites that use JavaScript to dynamically load content after the ready state returns complete. Additionally, this behavior does not apply to navigation triggered by clicking an element or submitting a form.
Note: It is generally advisable to keep the default value of this capability, "NORMAL" as interacting with the web page before all assets are fully loaded can lead to synchronization issues in the web application under test.
Proxy configuration (proxy)
A proxy server acts as a go-between for requests made by a client (such as a web browser) and a server. When a client makes a request to a server, the request is sent through the proxy server before reaching its intended destination. The proxy server then forwards the response back to the client. In automation scripts, a proxy server can be useful for accessing a website that may be restricted by complex network configurations or strict corporate policies. It can also be useful for accessing websites in cases where the agent machine is not directly connected to the internet, but accessible via a proxy.
{
"proxy": {
"proxyType": "MANUAL",
"autodetect": false,
"httpProxy": "<HOST:PORT>"
}
}
Strict file interactability (strictFileInteractability)
This new capability enables strict interactability checks for input[type='file'] elements. By default, these checks are not applied, but when enabled, they will change the behavior of using the "Element Send Keys" function with hidden file upload controls.
{
"strictFileInteractability": false
}
Unhandled prompt behavior (unhandledPromptBehavior)
This defines what action must be taken when a JavaScript alert or JavaScript prompt is encountered. This is defined by “unhandledPromptBehavior” capability and has the following states:
- dismiss
- accept
- dismiss and notify
- accept and notify
- ignore
Defaults to the “ignore” state.
{
"unhandledPromptBehavior": "accept"
}
Headless Mode (headless)
This option enables you to run tests in the background, without being able to view the browser during the test execution.
{
"headless": true
}
Browser Binary (binary)
This option enables you to specify a custom or non-default browser binary located in a different folder to use for automated test execution.
{
"binary":"C:\\acme\\browsers\\chrome.exe"
}
Incognito (incognito)
This option allows executing runs in Incognito mode (if Chrome) or a Private browser (if Firefox).
{
"incognito": true
}
Extensions (extensions)
This option allows loading multiple packaged extensions with paths ending with .crx (if Chrome) or .xpi (if Firefox) to the run browser.
{
"extensions": [
"C:\\acme\\Salesforce-inspector.crx",
"C:\\acme\\Speedtest-by-Ookla.crx"
]
}
Arguments (args)
This option allows passing arguments to browser binary during browser startup.
Example:
To set a custom user-agent string for the Chrome browser
{
"args":[user-agent=\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0\""]
}
Preferences (prefs)
This option allows you to set browser preferences. These are the options that you typically set in Selenium using:
-
ChromeOptions.setExperimentalOptions(“prefs”,Map<String,Object>) [Chrome]
-
(new FirefoxProfile()).setPreference()[Firefox]
Note: The options you set through FirefoxOptions.setPreference() method [Firefox] are not part of this Driver Profile option. Refer to the documentation on “Browser Capabilities” for this.
Chrome and Edge(Chromium)
This is the same as setting preferences as Experimental via ChromeOptions or EdgeOptions.
Here is a sample web profile config to disable the browser notification popup in the test-run browser.
{
"prefs": {
"profile.default_content_setting_values.notifications": 2
}
}
Firefox
For the Firefox browser, this is the same as setting preferences through FirefoxProfile in Selenium.
Here is a sample web profile configuration to set a custom user-agent string in your Firefox browser under test.
{
"prefs": {
"general.useragent.override": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"
}
}
nonStandardOptions[Deprecated]
This option allowed you to enable or disable browsers' capability to load extensions. This was commonly used by teams who wanted to disable auto-installing the default Selenium plugin to the automation browser, as there may be company restrictions to loading plugins on the automation browser.
Here is a sample example of the config that you may be using currently:
{
"nonStandardOptions": {
"chrome": {
"useAutomationExtension": false
}
}
}
The above config is now deprecated.
Instead, you can pass the below config through prefs as shown below:
{
"prefs": {
"useAutomationExtension": false
}
}
Browser Capabilities (browserCapabilities)
This option will allow setting any browser-specific capability that is usually set through browser options.
(new FirefoxOptions()).addPreference() //Firefox
(new ChromeOptions()).setExperimentalOption() //Chrome
(new EdgeOptions()).setExperimentalOption() //Edge
Here is a sample web profile to enable mic and camera permissions in Firefox browser under test:
{
"browserCapabilities": {
"prefs": {
"permissions.default.microphone": 1,
"permissions.default.camera": 1
}
}
}
Cloud Options (cloudOptions)
This option will allow you to pass any remote execution vendor-specific capabilities.
Here are a couple of examples of Cloud options for different vendors:
Browserstack:
{
"cloudOptions": {
"resolution" : "1920x1200",
"consoleLogs" : "info"
}
}
Example for setting Browserstack local:
The key browserstack.local is now deprecated. Now you need to use "local":true in cloud options as shown below:
{
"cloudOptions": {
"resolution" : "1920x1200",
"consoleLogs" : "info",
"local" : "true"
}
}
Saucelabs
{
"cloudOptions": {
"screenResolution": "1152x864",
"extendedDebugging": true,
"capturePerformance": true
}
}
Perfecto
{
"browserVersion": "107",
"cloudOptions": {
"platformVersion": "10",
"location": "AP Sydney",
"resolution": "1024x768"
}
}
LambdaTest
{
"cloudOptions": {
"visual": true,
"timezone": "UTC+05:30",
"resolution": "1280x1024"
}
}
Using a Web Driver Profile for Test Execution
You can specify the Web Driver Profile to use, when running the test. In the Run Modal, click on the section that displays Browser and OS icons. Expanded panel displays a dropdown to select the profile. If you choose not to use any special profile, just select None.
Selected Profile is saved in user cache and the Run modal always opens with this profile pre-selected.
What Configuration was used for a Test Run
Test Report displays the configuration that was used for a particular test run. Simply click on the "configuration" link in the summary section of your test run report.
Custom Driver Profile for Playback
You can select a custom Web Driver Profile in the Playback settings. This will allow you to control the browser invocation behavior for the embedded Recorder browser.
It is important to note that certain device-related settings specified in the Web Driver profile will be ignored when used for the Recorder browser. In addition, the Recorder browser always opens in headless mode.
The following settings from the Web Driver profile are ignored in Recorder browser.
- Device width and height
- Device pixel ratio
- User-agent string
Comments
0 comments
Please sign in to leave a comment.