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);
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
CAPABILITY
Key used to store SafariOptions in a
DesiredCapabilities object. |
| 构造器和说明 |
|---|
SafariOptions() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object other) |
static SafariOptions |
fromCapabilities(Capabilities capabilities)
Construct a
SafariOptions instance from given capabilites. |
int |
getPort() |
boolean |
getUseCleanSession() |
boolean |
getUseTechnologyPreview() |
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.
|
void |
setUseTechnologyPreview(boolean useTechnologyPreview)
Instruct the SafariDriver to use the Safari Technology Preview if true, otherwise use the
release version of Safari.
|
com.google.gson.JsonObject |
toJson()
Converts this instance to its JSON representation.
|
public static final String CAPABILITY
DesiredCapabilities object.public static SafariOptions fromCapabilities(Capabilities capabilities) throws 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.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 void setUseTechnologyPreview(boolean useTechnologyPreview)
useTechnologyPreview - If true, the SafariDriver will use the Safari Technology Preview,
otherwise will use the release version of Safari.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 boolean getUseTechnologyPreview()
public com.google.gson.JsonObject toJson()
throws IOException
IOException - If an error occurred while reading the Safari extension files.