public class SelectBrowser
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_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_SAFARI
'safari'
|
static java.lang.String |
DEFAULT_SELENIUM_HOST
'localhost'
|
static java.lang.String |
DEFAULT_SELENIUM_HOST_IP
'127.0.0.1'
|
static java.lang.String |
DEFAULT_SELENIUM_PORT
'4444'
|
static int |
DEFAULT_SELENIUM_PORT_INT
4444
|
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. |
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
|
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_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_GRID_NODES_SETTING
'selenium.node' the key for selenium grid node string;
The value is as "node1:port:nodeconfig;node2:port:nodeconfig;"
|
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 |
SYSTEM_PROPERTY_BROWSER_NAME
'BROWSER'
|
static java.lang.String |
SYSTEM_PROPERTY_BROWSER_REMOTE
'BROWSER_REMOTE'
|
static java.lang.String |
SYSTEM_PROPERTY_PROXY_BYPASS
'http.proxyBypass'
|
static java.lang.String |
SYSTEM_PROPERTY_PROXY_HOST
'http.proxyHost'
|
static java.lang.String |
SYSTEM_PROPERTY_PROXY_PORT
'http.proxyPort'
|
static java.lang.String |
SYSTEM_PROPERTY_SELENIUM_HOST
'selenium.host'
|
static java.lang.String |
SYSTEM_PROPERTY_SELENIUM_NODE
'selenium.node', its value is like node1:port:nodeconfig;node2:port:nodeconfig;
semi-colon(;) serves as separator between nodes, colon(:) serves as separator between nodename, port, and node-configuration. |
static java.lang.String |
SYSTEM_PROPERTY_SELENIUM_PORT
'selenium.port'
|
static java.lang.String |
SYSTEM_PROPERTY_WEBDRIVER_CHROME
'webdriver.chrome.driver'
|
static java.lang.String |
SYSTEM_PROPERTY_WEBDRIVER_EDGE
'webdriver.edge.driver'
|
static java.lang.String |
SYSTEM_PROPERTY_WEBDRIVER_IE
'webdriver.ie.driver'
|
Constructor and Description |
---|
SelectBrowser() |
Modifier and Type | Method and Description |
---|---|
static org.openqa.selenium.WebDriver |
getBrowserInstance(java.lang.String browserName) |
static org.openqa.selenium.WebDriver |
getBrowserInstance(java.lang.String browserName,
java.util.Map<java.lang.String,java.lang.Object> extraParameters) |
static org.openqa.selenium.remote.DesiredCapabilities |
getDesiredCapabilities(java.lang.String browserName) |
static org.openqa.selenium.remote.DesiredCapabilities |
getDesiredCapabilities(java.lang.String browserName,
java.util.Map<java.lang.String,java.lang.Object> extraParameters) |
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. |
static org.openqa.selenium.firefox.FirefoxProfile |
getFirefoxProfile(java.lang.String profileNameOrPath)
Create a FirefoxProfile according to a profile's name of profile's filename.
|
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
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
public static final java.lang.String KEY_CHROME_DISABLE_EXTENSIONS
public static final java.lang.String KEY_GRID_NODES_SETTING
public static final java.lang.String SYSTEM_PROPERTY_PROXY_HOST
public static final java.lang.String SYSTEM_PROPERTY_PROXY_PORT
public static final java.lang.String SYSTEM_PROPERTY_PROXY_BYPASS
public static final java.lang.String SYSTEM_PROPERTY_SELENIUM_HOST
public static final java.lang.String SYSTEM_PROPERTY_SELENIUM_PORT
public static final java.lang.String SYSTEM_PROPERTY_SELENIUM_NODE
public static final java.lang.String SYSTEM_PROPERTY_WEBDRIVER_IE
public static final java.lang.String SYSTEM_PROPERTY_WEBDRIVER_CHROME
public static final java.lang.String SYSTEM_PROPERTY_WEBDRIVER_EDGE
public static final java.lang.String SYSTEM_PROPERTY_BROWSER_NAME
public static final java.lang.String SYSTEM_PROPERTY_BROWSER_REMOTE
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_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 DEFAULT_SELENIUM_HOST
public static final java.lang.String DEFAULT_SELENIUM_HOST_IP
public static final int DEFAULT_SELENIUM_PORT_INT
public static final java.lang.String DEFAULT_SELENIUM_PORT
public static org.openqa.selenium.WebDriver getBrowserInstance(java.lang.String browserName)
browserName
- String, the browser name, such as "explorer"#getBrowserInstance(String, HashMap)
public static org.openqa.selenium.WebDriver getBrowserInstance(java.lang.String browserName, java.util.Map<java.lang.String,java.lang.Object> extraParameters)
browserName
- String, the browser name, such as "explorer". If null, then the
System.property SYSTEM_PROPERTY_BROWSER_NAME
is sought. If not set, then the
default BROWSER_NAME_FIREFOX
is used.extraParameters
- HashMappublic static org.openqa.selenium.remote.DesiredCapabilities getDesiredCapabilities(java.lang.String browserName)
browserName
- String, the browser name, such as "explorer"#getDesiredCapabilities(String, HashMap)
public static org.openqa.selenium.remote.DesiredCapabilities getDesiredCapabilities(java.lang.String browserName, java.util.Map<java.lang.String,java.lang.Object> extraParameters)
browserName
- String, the browser name, such as "explorer"extraParameters
- Mappublic static org.openqa.selenium.firefox.FirefoxProfile getFirefoxProfile(java.lang.String profileNameOrPath)
profileNameOrPath
- String, Can be profile's name or profile's file name (absolute)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_USER_DATA_DIR
,
KEY_CHROME_PROFILE_DIR
,
KEY_CHROME_EXCLUDE_OPTIONS
Copyright © SAS Institute. All Rights Reserved.