public class SafariOptions
extends java.lang.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 | Class and Description |
---|---|
private static class |
SafariOptions.Option |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CAPABILITY
Key used to store SafariOptions in a
DesiredCapabilities object. |
private int |
port |
private boolean |
useCleanSession |
Constructor and Description |
---|
SafariOptions() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
static SafariOptions |
fromCapabilities(org.openqa.selenium.Capabilities capabilities)
Construct a
SafariOptions instance from given capabilites. |
private static SafariOptions |
fromJsonMap(java.util.Map<?,?> options)
Parse a Map and reconstruct the
SafariOptions . |
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.
|
(package private) org.openqa.selenium.remote.DesiredCapabilities |
toCapabilities()
Returns DesiredCapabilities for Safari with these options included as
capabilities.
|
com.google.gson.JsonObject |
toJson()
Converts this instance to its JSON representation.
|
public static final java.lang.String CAPABILITY
DesiredCapabilities
object.private int port
setPort(int)
private boolean useCleanSession
setUseCleanSession(boolean)
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 java.io.IOException
java.io.IOException
- If an error occurred while reading the Safari extension files.private static SafariOptions fromJsonMap(java.util.Map<?,?> options) throws java.io.IOException
SafariOptions
.
A temporary directory is created to hold all Safari extension files.options
- A Map derived from the output of toJson()
.SafariOptions
instance associated with these extensions.java.io.IOException
- If an error occurred while writing the safari extensions to a
temporary directory.org.openqa.selenium.remote.DesiredCapabilities toCapabilities()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object