public class SafariOptions extends Object
SafariDriver
.
Example usage:
SafariOptions options = new SafariOptions()
options.setUseCleanSession(true);
// For use with SafariDriver:
SafariDriver driver = new SafariDriver(options);
// For use with RemoteWebDriver:
DesiredCapabilities capabilities = DesiredCapabilities.safari();
capabilities.setCapability(SafariOptions.CAPABILITY, options);
RemoteWebDriver driver = new RemoteWebDriver(
new URL("http://localhost:4444/wd/hub"), capabilities);
Modifier and Type | Field and Description |
---|---|
static String |
CAPABILITY
Key used to store SafariOptions in a
DesiredCapabilities object. |
Constructor and Description |
---|
SafariOptions() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
static SafariOptions |
fromCapabilities(org.openqa.selenium.Capabilities capabilities)
Construct a
SafariOptions instance from given capabilites. |
int |
getPort() |
boolean |
getUseCleanSession() |
int |
hashCode() |
void |
setPort(int port)
Set the port the
SafariDriverServer should be started on. |
void |
setUseCleanSession(boolean useCleanSession)
Instruct the SafariDriver to delete all existing session data when starting a new session.
|
com.google.gson.JsonObject |
toJson()
Converts this instance to its JSON representation.
|
public static final String CAPABILITY
DesiredCapabilities
object.public static SafariOptions fromCapabilities(org.openqa.selenium.Capabilities capabilities) throws org.openqa.selenium.WebDriverException
SafariOptions
instance from given capabilites.
When the CAPABILITY
capability is set, all other capabilities will be ignored!capabilities
- Desired capabilities from which the options are derived.org.openqa.selenium.WebDriverException
- If an error occurred during the reconstruction of the optionspublic void setPort(int port)
SafariDriverServer
should be started on. Defaults to 0, in which case
the server selects a free port.port
- The port the SafariDriverServer
should be started on,
or 0 if the server should select a free port.public void setUseCleanSession(boolean useCleanSession)
Warning: Since Safari uses a single profile for the current user, enabling this capability will permanently erase any existing session data.
useCleanSession
- If true, the SafariDriver will erase all existing session data.public int getPort()
SafariDriverServer
should be started on.
If 0, the server should select a free port.setPort(int)
public boolean getUseCleanSession()
setUseCleanSession(boolean)
public com.google.gson.JsonObject toJson() throws IOException
IOException
- If an error occurred while reading the Safari extension files.Copyright © 2016. All rights reserved.