class Options
webdriver.Serializable └ Options
Class for managing ChromeDriver specific options.
Instance Methods
addArguments(var_args)code »
Add additional command line arguments to use when launching the Chrome browser. Each argument may be specified with or without the "--" prefix (e.g. "--foo" and "foo"). Arguments with an associated value should be delimited by an "=": "foo=bar".
addExtensions(var_args)code »
Add additional extensions to install when launching Chrome. Each extension should be specified as the path to the packed CRX file, or a Buffer for an extension.
androidActivity(name)code »
Sets the name of the activity hosting a Chrome-based Android WebView. This option must be set to connect to an [Android WebView]( https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android)
androidChrome()code »
Configures the ChromeDriver to launch Chrome on Android via adb. This function is shorthand for options.androidPackage('com.android.chrome')
.
Options
A self reference.
androidDeviceSerial(serial)code »
Sets the device serial number to connect to via ADB. If not specified, the ChromeDriver will select an unused device at random. An error will be returned if all devices already have active sessions.
androidProcess(processName)code »
Sets the process name of the Activity hosting the WebView (as given by ps
). If not specified, the process name is assumed to be the same as #androidPackage
.
detachDriver(detach)code »
Sets whether to leave the started Chrome browser running if the controlling ChromeDriver service is killed before webdriver.WebDriver#quit()
is called.
serialize()code »
Converts this instance to its JSON wire protocol representation. Note this function is an implementation not intended for general use.
Overrides: webdriver.Serializable
setChromeBinaryPath(path)code »
Sets the path to the Chrome binary to use. On Mac OS X, this path should reference the actual Chrome executable, not just the application binary (e.g. "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome").
The binary path be absolute or relative to the chromedriver server executable, but it must exist on the machine that will launch Chrome.
setLoggingPrefs(prefs)code »
Sets the logging preferences for the new session.
- prefs
webdriver.logging.Preferences
The logging preferences.
Options
A self reference.
setMobileEmulation(config)code »
Configures Chrome to emulate a mobile device. For more information, refer to the ChromeDriver project page on mobile emulation. Configuration options include:
deviceName
: The name of a pre-configured emulated devicewidth
: screen width, in pixelsheight
: screen height, in pixelspixelRatio
: screen pixel ratio
Example 1: Using a Pre-configured Device
var options = new chrome.Options().setMobileEmulation(
{deviceName: 'Google Nexus 5'});
var driver = new chrome.Driver(options);
Example 2: Using Custom Screen Configuration
var options = new chrome.Options().setMobileEmulation({
width: 360,
height: 640,
pixelRatio: 3.0
});
var driver = new chrome.Driver(options);
setPerfLoggingPrefs(prefs)code »
Sets the performance logging preferences. Options include:
enableNetwork
: Whether or not to collect events from Network domain.enablePage
: Whether or not to collect events from Page domain.enableTimeline
: Whether or not to collect events from Timeline domain. Note: when tracing is enabled, Timeline domain is implicitly disabled, unlessenableTimeline
is explicitly set to true.tracingCategories
: A comma-separated string of Chrome tracing categories for which trace events should be collected. An unspecified or empty string disables tracing.bufferUsageReportingInterval
: The requested number of milliseconds between DevTools trace buffer usage events. For example, if 1000, then once per second, DevTools will report how full the trace buffer is. If a report indicates the buffer usage is 100%, a warning will be issued.
setProxy(proxy)code »
Sets the proxy settings for the new session.
- proxy
selenium-webdriver.ProxyConfig
The proxy configuration to use.
Options
A self reference.
toCapabilities(opt_capabilities)code »
Converts this options instance to a webdriver.Capabilities
object.
- opt_capabilities
?Capabilities=
The capabilities to merge these options into, if any.
webdriver.Capabilities
The capabilities.
Static Functions
Options.fromCapabilities(capabilities)code »
Extracts the ChromeDriver specific options from the given capabilities object.
- capabilities
webdriver.Capabilities
The capabilities object.
Options
The ChromeDriver options.