Package org.openqa.selenium.chromium
Class ChromiumOptions<T extends ChromiumOptions<?>>
java.lang.Object
org.openqa.selenium.MutableCapabilities
org.openqa.selenium.remote.AbstractDriverOptions<ChromiumOptions<?>>
org.openqa.selenium.chromium.ChromiumOptions<T>
- All Implemented Interfaces:
Serializable
,Capabilities
- Direct Known Subclasses:
ChromeOptions
,EdgeOptions
public class ChromiumOptions<T extends ChromiumOptions<?>>
extends AbstractDriverOptions<ChromiumOptions<?>>
Class to manage options specific to
ChromiumDriver
.
Example usage:
ChromeOptions options = new ChromeOptions()
options.addExtensions(new File("/path/to/extension.crx"))
options.setBinary(new File("/path/to/chrome"));
// For use with ChromeDriver:
ChromeDriver driver = new ChromeDriver(options);
// For use with RemoteWebDriver:
RemoteWebDriver driver = new RemoteWebDriver(
new URL("http://localhost:4444/"),
new ChromeOptions());
- Since:
- Since chromedriver v17.0.963.0
- See Also:
-
Constructor Summary
ConstructorDescriptionChromiumOptions
(String capabilityType, String browserType, String capability) -
Method Summary
Modifier and TypeMethodDescriptionaddArguments
(String... arguments) addArguments
(List<String> arguments) Adds additional command line arguments to be used when starting Chrome.addEncodedExtensions
(String... encoded) addEncodedExtensions
(List<String> encoded) Adds a new Chrome extension to install on browser startup.addExtensions
(File... paths) addExtensions
(List<File> paths) Adds a new Chrome extension to install on browser startup.protected Object
getExtraCapability
(String capabilityName) protected void
mergeInOptionsFromCaps
(String capabilityName, Capabilities capabilities) protected void
mergeInPlace
(Capabilities capabilities) setAndroidActivity
(String activity) setAndroidDeviceSerialNumber
(String serial) setAndroidPackage
(String androidPackage) setAndroidProcess
(String processName) Process name of the Activity hosting the WebView (as given by ps).Sets the path to the Chrome executable.Sets the path to the Chrome executable.setExperimentalOption
(String name, Object value) Sets an experimental option.setUseRunningAndroidApp
(boolean useIt) Methods inherited from class org.openqa.selenium.remote.AbstractDriverOptions
asMap, getCapability, getCapabilityNames, setAcceptInsecureCerts, setBrowserVersion, setEnableDownloads, setImplicitWaitTimeout, setPageLoadStrategy, setPageLoadTimeout, setPlatformName, setProxy, setScriptTimeout, setStrictFileInteractability, setUnhandledPromptBehaviour
Methods inherited from class org.openqa.selenium.MutableCapabilities
equals, hashCode, merge, setCapability, setCapability, setCapability, setCapability, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.openqa.selenium.Capabilities
getBrowserName, getBrowserVersion, getPlatformName, is
-
Constructor Details
-
ChromiumOptions
-
-
Method Details
-
setBinary
Sets the path to the Chrome executable. This path should exist on the machine which will launch Chrome. The path should either be absolute or relative to the location of running ChromeDriver server.- Parameters:
path
- Path to Chrome executable.
-
setBinary
Sets the path to the Chrome executable. This path should exist on the machine which will launch Chrome. The path should either be absolute or relative to the location of running ChromeDriver server.- Parameters:
path
- Path to Chrome executable.
-
addArguments
- Parameters:
arguments
- The arguments to use when starting Chrome.- See Also:
-
addArguments
Adds additional command line arguments to be used when starting Chrome. For example:options.addArguments( "load-extension=/path/to/unpacked_extension", "allow-outdated-plugins");
Each argument may contain an optional "--" prefix: "--foo" or "foo". Arguments with an associated value should be delimited with an "=": "foo=bar".
- Parameters:
arguments
- The arguments to use when starting Chrome.
-
addExtensions
- Parameters:
paths
- Paths to the extensions to install.- See Also:
-
addExtensions
Adds a new Chrome extension to install on browser startup. Each path should specify a packed Chrome extension (CRX file).- Parameters:
paths
- Paths to the extensions to install.
-
addEncodedExtensions
- Parameters:
encoded
- Base64 encoded data of the extensions to install.- See Also:
-
addEncodedExtensions
Adds a new Chrome extension to install on browser startup. Each string data should specify a Base64 encoded string of packed Chrome extension (CRX file).- Parameters:
encoded
- Base64 encoded data of the extensions to install.
-
enableBiDi
-
setExperimentalOption
Sets an experimental option. Useful for new ChromeDriver options not yet exposed through theChromiumOptions
API.- Parameters:
name
- Name of the experimental option.value
- Value of the experimental option, which must be convertible to JSON.
-
setAndroidPackage
-
setAndroidActivity
-
setAndroidDeviceSerialNumber
-
setUseRunningAndroidApp
-
setAndroidProcess
Process name of the Activity hosting the WebView (as given by ps). If not set, the process name is assumed to be the same as androidPackage. -
getExtraCapabilityNames
- Specified by:
getExtraCapabilityNames
in classAbstractDriverOptions<ChromiumOptions<?>>
-
getExtraCapability
- Specified by:
getExtraCapability
in classAbstractDriverOptions<ChromiumOptions<?>>
-
mergeInPlace
-
mergeInOptionsFromCaps
-