|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openqa.selenium.chrome.ChromeOptions
public class ChromeOptions
Class to manage options specific to ChromeDriver.
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:
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
RemoteWebDriver driver = new RemoteWebDriver(
new URL("http://localhost:4444/wd/hub"), capabilities);
| Field Summary | |
|---|---|
static java.lang.String |
CAPABILITY
Key used to store a set of ChromeOptions in a DesiredCapabilities
object. |
| Constructor Summary | |
|---|---|
ChromeOptions()
|
|
| Method Summary | |
|---|---|
void |
addArguments(java.util.List<java.lang.String> arguments)
Adds additional command line arguments to be used when starting Chrome. |
void |
addArguments(java.lang.String... arguments)
|
void |
addExtensions(java.io.File... paths)
|
void |
addExtensions(java.util.List<java.io.File> paths)
Adds a new Chrome extension to install on browser startup. |
void |
setBinary(java.io.File path)
Sets the path to the Chrome executable. |
org.json.JSONObject |
toJson()
Converts this instance to its JSON representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CAPABILITY
DesiredCapabilities
object.
| Constructor Detail |
|---|
public ChromeOptions()
| Method Detail |
|---|
public void setBinary(java.io.File path)
path - Path to Chrome executable.public void addArguments(java.lang.String... arguments)
arguments - The arguments to use when starting Chrome.addArguments(java.util.List)public void addArguments(java.util.List<java.lang.String> arguments)
options.setArguments(
"load-extension=/path/to/unpacked_extension",
"allow-outdated-plugins");
Each argument may contain an option "--" prefix: "--foo" or "foo". Arguments with an associated value should be delimitted with an "=": "foo=bar".
arguments - The arguments to use when starting Chrome.public void addExtensions(java.io.File... paths)
paths - Paths to the extensions to install.addExtensions(java.util.List)public void addExtensions(java.util.List<java.io.File> paths)
paths - Paths to the extensions to install.
public org.json.JSONObject toJson()
throws java.io.IOException,
org.json.JSONException
java.io.IOException - If an error occurs while reading the
extension files from disk.
org.json.JSONException - If an error occurs while encoding these options as
JSON.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||