public abstract static class Constants.BrowserConstants
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BROWSER_NAME_ANDROID_CHROME
'android.chrome' chrome browser on android
|
static java.lang.String |
BROWSER_NAME_CHROME
'chrome'
|
static java.lang.String |
BROWSER_NAME_CHROMIUM_EDGE
'ChromiumEdge'
|
static java.lang.String |
BROWSER_NAME_EDGE
'MicrosoftEdge'
|
static java.lang.String |
BROWSER_NAME_FIREFOX
'firefox'
|
static java.lang.String |
BROWSER_NAME_HTMLUNIT
'htmlunit'
|
static java.lang.String |
BROWSER_NAME_IE
'explorer'
|
static java.lang.String |
BROWSER_NAME_IPAD_SAFARI
'ipad.safari' safari browser on ios
|
static java.lang.String |
BROWSER_NAME_IPAD_SIMULATOR_SAFARI
'ipad.sim.safari' simulator on ios
|
static java.lang.String |
BROWSER_NAME_OPERA
'opera'
|
static java.lang.String |
BROWSER_NAME_OPERA_BLINK
'operablink'
|
static java.lang.String |
BROWSER_NAME_SAFARI
'safari'
|
static boolean |
DEFAULT_DISABLE_CHROME_EXTENSION
true Disable extensions to avoid popping up 'Disable developer mode extensions' message in chrome browser.
|
static java.lang.String |
KEY_CHROME_DISABLE_EXTENSIONS
'--disable-extensions' is used to disable the use of Chrome extensions.
|
static java.lang.String |
KEY_CHROME_EXCLUDE_OPTIONS
'excludeSwitches' the experimental option name for chrome options, it is used to turn off chrome starting options.
The value is separated-options to exclude, the separator can be comma(,) or semicolon(;) , like "disable-component-update, ignore-certificate-errors" or "disable-component-update; ignore-certificate-errors", be careful, there are NO 2 hyphens before options, "--disable-component-update, --ignore-certificate-errors" is wrong. Note: As the value, excluded-options, may contain minus like "disable-component-update", it could be interpreted as an arithmetic expression, Use SeleniumPlus.quote("disable-component-update") to keep its value. NOTE: We can also specify this by key "excludeSwitches" for KEY_CHROME_EXPERIMENTAL_OPTIONS . |
static java.lang.String |
KEY_CHROME_EXPERIMENTAL_OPTIONS
'experimentalOptions' the key for chrome Experimental Options, it contains:
experimental options json data, such as { "useAutomationExtension":"false",
"prefs": { "intl.accept_languages":"zh-cn", "intl.charset_default":"utf-8" },
"excludeSwitches": ["enable-automation", "disable-component-update", "ignore-certificate-errors"]}
|
static java.lang.String |
KEY_CHROME_EXTENSION_MODHEADER_PROFILE
'extension-modheader-profile' the key to indicate the extension ModHeader's profile, the profile can be:
|
static java.lang.String |
KEY_CHROME_EXTENSIONS
'extensions' the key to indicate the browser's extensions in a json file, the extensions are expressed as an array.
This key:value pair will be used in the json file indicated by KEY_CHROME_LOAD_EXTENSIONS .E.g. |
static java.lang.String |
KEY_CHROME_LOAD_EXTENSIONS
'load-extensions' is used to load Chrome extensions, and probably load profile for extensions when starting web browser.
It can be specified by a json file which contains KEY_CHROME_EXTENSIONS and KEY_CHROME_EXTENSION_MODHEADER_PROFILE .KEY_CHROME_EXTENSIONS is required, while KEY_CHROME_EXTENSION_MODHEADER_PROFILE is optional.In 'SeleniumPlus.StartWebBrowser()' or 'WDLibrary.startBrowser()', we can set browser's extensions to start with, and the profile to load for a certain extension. The E.g. |
static java.lang.String |
KEY_CHROME_NO_SANDBOX
'--no-sandbox' is used to start Chrome without sandbox.
|
static java.lang.String |
KEY_CHROME_PREFERENCE
'chrome.perference' the key for chrome command-line-options/preferences file, which contains
command-line-options json data, such as { "lang":"zh-cn", "disable-download-notification":"" },
refer to detail options
preferences json data, it is indicated by a special key
KEY_CHROME_PREFERENCE_JSON_KEY ,
such as { "seplus.chrome.preference.json.key": { "intl.accept_languages":"zh-cn", "intl.charset_default":"utf-8" } },
refer to detail preferences
|
static java.lang.String |
KEY_CHROME_PREFERENCE_JSON_KEY
'seplus.chrome.preference.json.key' the key for chrome preferences, which points to json data,
such as { "intl.accept_languages":"zh-cn", "intl.charset_default":"utf-8" },
refer to detail preferences
NOTE: We can also specify this by key "prefs" for KEY_CHROME_EXPERIMENTAL_OPTIONS . |
static java.lang.String |
KEY_CHROME_PREFS
The chrome Experimental Option prefs.
|
static java.lang.String |
KEY_CHROME_PROFILE_DIR
'profile-directory' the parameter name for chrome options, a user-specific settings, it indicates a sub-folder under "user data directory".
The value is specified in chrome options Note: As this "profile-directory" contains minus, it could be interpreted as an arithmetic expression, Use SeleniumPlus.quote("profile-directory") to keep its value. |
static java.lang.String |
KEY_CHROME_USER_DATA_DIR
'user-data-dir' the parameter name for chrome options, a general custom data settings.
The value is specified in chrome options Note: As this "user-data-dir" contains minus, it could be interpreted as an arithmetic expression, Use SeleniumPlus.quote("user-data-dir") to keep its value. |
static java.lang.String |
KEY_CUSTOM_CAPABILITIES
'custom.capabilities' the key for custom capabilities, which is json data,
such as { "key-1":"value", "key-2":"value" }, they will be added to the standard capabilities.
|
static java.lang.String |
KEY_FIREFOX_PROFILE
'FirefoxProfile' the key for firefox profile name/filename string;
The value is something like "myprofile" or "<AbsolutePath>/ppc2784x.default"
|
static java.lang.String |
KEY_FIREFOX_PROFILE_PREFERENCE
'firefox.perference' the key for firefox preference file, which contains json data,
such as { "intl.accept_languages":"zh-cn", "accessibility.accesskeycausesactivation":false, "browser.download.folderList":2 }
Note: Be careful when creating the json data file, do NOT quote boolean or integer value. |
static java.lang.String |
KEY_PROXY_BYPASS_ADDRESS
'KEY_PROXY_BYPASS_ADDRESS' the key for proxy bypass address string;
The value is comma separated string as "localhost, internal.server"
|
static java.lang.String |
KEY_PROXY_SETTING
'KEY_PROXY_SETTING' the key for proxy string;
The value is colon separated string as "proxyserver:port"
|
static java.lang.String |
KEY_SET_NETWORK_CONDITIONS
'setNetworkConditions' is used to start browser (now, for Chrome only) with network conditions (turn on this ability), which should be in JSON string.
This JSON can contain keys of "offline"(boolean), "latency"(integer ms), "download_throughput"(integer bps), "upload_throughput"(integer bps). |
Constructor and Description |
---|
BrowserConstants() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getExtraParameterKeys()
Return an array of keys for extra parameters.
The format of value for each key is different, please refer to comment of the key. |
public static final java.lang.String BROWSER_NAME_IE
public static final java.lang.String BROWSER_NAME_CHROME
public static final java.lang.String BROWSER_NAME_FIREFOX
public static final java.lang.String BROWSER_NAME_SAFARI
public static final java.lang.String BROWSER_NAME_EDGE
public static final java.lang.String BROWSER_NAME_CHROMIUM_EDGE
public static final java.lang.String BROWSER_NAME_OPERA_BLINK
public static final java.lang.String BROWSER_NAME_OPERA
public static final java.lang.String BROWSER_NAME_HTMLUNIT
public static final java.lang.String BROWSER_NAME_ANDROID_CHROME
public static final java.lang.String BROWSER_NAME_IPAD_SAFARI
public static final java.lang.String BROWSER_NAME_IPAD_SIMULATOR_SAFARI
public static final java.lang.String KEY_PROXY_SETTING
public static final java.lang.String KEY_PROXY_BYPASS_ADDRESS
public static final java.lang.String KEY_FIREFOX_PROFILE
public static final java.lang.String KEY_FIREFOX_PROFILE_PREFERENCE
public static final java.lang.String KEY_CHROME_PREFERENCE
KEY_CHROME_PREFERENCE_JSON_KEY
,
such as { "seplus.chrome.preference.json.key": { "intl.accept_languages":"zh-cn", "intl.charset_default":"utf-8" } },
refer to detail preferences
public static final java.lang.String KEY_CHROME_PREFERENCE_JSON_KEY
KEY_CHROME_EXPERIMENTAL_OPTIONS
.public static final java.lang.String KEY_CHROME_PREFS
public static final java.lang.String KEY_CHROME_EXPERIMENTAL_OPTIONS
public static final java.lang.String KEY_CHROME_USER_DATA_DIR
KEY_CHROME_PROFILE_DIR
,
Constant Field Valuespublic static final java.lang.String KEY_CHROME_PROFILE_DIR
KEY_CHROME_USER_DATA_DIR
,
Constant Field Valuespublic static final java.lang.String KEY_CHROME_EXCLUDE_OPTIONS
KEY_CHROME_EXPERIMENTAL_OPTIONS
.public static final java.lang.String KEY_CHROME_DISABLE_EXTENSIONS
public static final java.lang.String KEY_CHROME_LOAD_EXTENSIONS
KEY_CHROME_EXTENSIONS
and KEY_CHROME_EXTENSION_MODHEADER_PROFILE
.KEY_CHROME_EXTENSIONS
is required, while KEY_CHROME_EXTENSION_MODHEADER_PROFILE
is optional.WDLibrary.startBrowser(BrowserName, Url, Id, timeout, isRemote, quote(SelectBrowser.KEY_CHROME_LOAD_EXTENSIONS), quote("loadExtensions.json")); The file "loadExtensions.json" contains "extensions" (required) and "extension-modheader-profile" (optional), such as: { "extensions": ["C:\\SeleniumPlus\\extra\\ModHeader.crx"], } or { "extensions": ["C:\\SeleniumPlus\\extra\\ModHeader.crx"], "extension-modheader-profile": "C:\\SeleniumPlus\\extra\\ModHeader.json" } or { "extensions": ["C:\\SeleniumPlus\\extra\\ModHeader.crx"], "extension-modheader-profile": "https://bewisse.com/modheader/p/#NobwRAhgDlCmB2ATAsge0bMAuAZhANgM6wA0YARhAMYDWA5gE6oCuSAwqvqg9mAMQA2cgFYAzMIBMYMjgCW+AC6wGhbMAC6ZABawIGFWvBVUAWxMIFvaWAQRy+WImwKGzUmHgRzvAB4BaQghCPygmKAg6CCU-WScyADcCN15EUwhZeGZiHgBfTTAtWNgOMwtnV3cGWEIoAAldfVUsDTJCLW4FABVZBQdeAEZrJR8FDi4eLH4caZmhnr7JgAUmOQcAAkGyZgZ8ACVYKHxqWHN4BSaNPKA" } or { "extensions": ["C:\\SeleniumPlus\\extra\\ModHeader.crx"], "extension-modheader-profile": [{"appendMode":false,"backgroundColor":"#6b5352","filters":[],"headers":[{"comment":"","enabled":true,"name":"x-sas-propagate-id","value":"domainuser"}],"hideComment":true,"respHeaders":[],"shortTitle":"1","textColor":"#ffffff","title":"Profile 1","urlReplacements":[]}] }
public static final java.lang.String KEY_CHROME_EXTENSIONS
KEY_CHROME_LOAD_EXTENSIONS
."extensions": ["C:\\SeleniumPlus\\extra\\ModHeader.crx", "C:\\SeleniumPlus\\extra\\anOtherExtension.crx"]
KEY_CHROME_LOAD_EXTENSIONS
,
Constant Field Valuespublic static final java.lang.String KEY_CHROME_EXTENSION_MODHEADER_PROFILE
1. a json file containing the profile, such as "C:\\SeleniumPlus\\extra\\ModHeader.json" 2. a json string representing the profile, such as [{"appendMode":false,"backgroundColor":"#6b5352","filters":[],"headers":[{"comment":"","enabled":true,"name":"x-sas-propagate-id","value":"domainuser"}],"hideComment":true,"respHeaders":[],"shortTitle":"1","textColor":"#ffffff","title":"Profile 1","urlReplacements":[]}] 3. an "url" representing the profile, such as "https://bewisse.com/modheader/p/#NobwRAhgDlCmB2ATAsge0bMAuAZhANgM6wA0YARhAMYDWA5gE6oCuSAwqvqg9mAMQA2cgFYAzMIBMYMjgCW+AC6wGhbMAC6ZABawIGFWvBVUAWxMIFvaWAQRy+WImwKGzUmHgRzvAB4BaQghCPygmKAg6CCU-WScyADcCN15EUwhZeGZiHgBfTTAtWNgOMwtnV3cGWEIoAAldfVUsDTJCLW4FABVZBQdeAEZrJR8FDi4eLH4caZmhnr7JgAUmOQcAAkGyZgZ8ACVYKHxqWHN4BSaNPKA"This key:value pair will be used in the json file indicated by
KEY_CHROME_LOAD_EXTENSIONS
."extension-modheader-profile": "C:\\SeleniumPlus\\extra\\ModHeader.json" "extension-modheader-profile": [{"appendMode":false,"backgroundColor":"#6b5352","filters":[],"headers":[{"comment":"","enabled":true,"name":"x-sas-propagate-id","value":"domainuser"}],"hideComment":true,"respHeaders":[],"shortTitle":"1","textColor":"#ffffff","title":"Profile 1","urlReplacements":[]}] "extension-modheader-profile": "https://bewisse.com/modheader/p/#NobwRAhgDlCmB2ATAsge0bMAuAZhANgM6wA0YARhAMYDWA5gE6oCuSAwqvqg9mAMQA2cgFYAzMIBMYMjgCW+AC6wGhbMAC6ZABawIGFWvBVUAWxMIFvaWAQRy+WImwKGzUmHgRzvAB4BaQghCPygmKAg6CCU-WScyADcCN15EUwhZeGZiHgBfTTAtWNgOMwtnV3cGWEIoAAldfVUsDTJCLW4FABVZBQdeAEZrJR8FDi4eLH4caZmhnr7JgAUmOQcAAkGyZgZ8ACVYKHxqWHN4BSaNPKA"
KEY_CHROME_LOAD_EXTENSIONS
,
Constant Field Valuespublic static final java.lang.String KEY_CHROME_NO_SANDBOX
In 'SeleniumPlus.StartWebBrowser()' or 'WDLibrary.startBrowser()', we can set this option as below:
E.g.
SeleniumPlus.StartWebBrowser(URL, BrowserID, BrowserName, timeout, isRemote, quote(BrowserConstants.KEY_CHROME_NO_SANDBOX), "true");
WDLibrary.startBrowser(BrowserName, Url, Id, timeout, isRemote, quote(BrowserConstants.KEY_CHROME_NO_SANDBOX), "true");
public static final java.lang.String KEY_SET_NETWORK_CONDITIONS
In 'SeleniumPlus.StartWebBrowser()' or 'SAFSPlus.DriverCommand.StartWebBrowser()', we can set this option as below:
E.g.
SeleniumPlus.StartWebBrowser(URL, BrowserID, BrowserName, timeout, isRemote, quote(BrowserConstants.KEY_SET_NETWORK_CONDITIONS), "{ \"offline\":false, \"latency\":5, \"download_throughput\":500000 , \"upload_throughput\":500000}");
SAFSPlus.DriverCommand.StartWebBrowser(URL, BrowserID, BrowserName, timeout, isRemote, quote(BrowserConstants.KEY_SET_NETWORK_CONDITIONS), "{ \"offline\":false, \"latency\":5, \"download_throughput\":500000 , \"upload_throughput\":500000}");
Once we started browser (now, for Chrome only) with this option 'setNetworkConditions', we can get/delete/set 'network conditions' as below:
String networkConditions = SAFSPlus.DriverCommand.GetNetworkConditions();
boolean success = SAFSPlus.DriverCommand.DeleteNetworkConditions();
SAFSPlus.DriverCommand.SetNetworkConditions("{ \"offline\":false, \"latency\":5, \"download_throughput\":500000 , \"upload_throughput\":500000}");
public static final java.lang.String KEY_CUSTOM_CAPABILITIES
public static final boolean DEFAULT_DISABLE_CHROME_EXTENSION
public static java.lang.String[] getExtraParameterKeys()
KEY_PROXY_BYPASS_ADDRESS
,
KEY_PROXY_SETTING
,
KEY_FIREFOX_PROFILE
,
KEY_FIREFOX_PROFILE_PREFERENCE
,
KEY_CHROME_PREFERENCE
,
KEY_CHROME_EXPERIMENTAL_OPTIONS
,
KEY_CHROME_USER_DATA_DIR
,
KEY_CHROME_PROFILE_DIR
,
KEY_CHROME_EXCLUDE_OPTIONS
,
KEY_CHROME_DISABLE_EXTENSIONS
,
KEY_CHROME_LOAD_EXTENSIONS
,
Constants.SeleniumConstants.KEY_GRID_NODES_SETTING
,
KEY_CHROME_NO_SANDBOX
,
KEY_SET_NETWORK_CONDITIONS
,
KEY_CUSTOM_CAPABILITIES
Copyright © SAS Institute. All Rights Reserved.