public class OperaSettings extends Object
OperaDriver.
OperaSettings serves as the internal storage for OperaDriver related settings and as a converter
between DesiredCapabilities and other internal resources.
Example usage:
OperaSettings settings = new OperaSettings();
settings.setBinary(new File("/path/to/opera"));
settings.arguments().add("foo", "bar");
settings.logging().getLevel(Level.FINE);
For use with OperaDriver:
OperaDriver driver = new OperaDriver(settings);
For use with RemoteWebDriver:
DesiredCapabilities capabilities = DesiredCapabilities.opera();
capabilities.merge(settings.toCapabilities());
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),
capabilities);
| Modifier and Type | Class and Description |
|---|---|
static class |
OperaSettings.Builder
Supplier of an
OperaSettings instance with the ability to specify which OperaSettings.Builder.usingProfile(OperaProfile) to use. |
static class |
OperaSettings.Capability
The capabilities specifically available to Opera.
|
class |
OperaSettings.OperaLogging
Manages settings related to logging in
OperaDriver and related processes, such as
OperaRunner and Opera itself. |
| Constructor and Description |
|---|
OperaSettings()
Constructs a new set of settings for
OperaDriver and Opera to use. |
OperaSettings(OperaProfile profile)
Constructs a new set of settings for
OperaDriver and Opera to use based on the given
profile. |
| Modifier and Type | Method and Description |
|---|---|
OperaArguments |
arguments()
Gets the arguments passed on to Opera.
|
boolean |
autostart()
Whether or not Opera should be launched on initialization.
|
void |
autostart(boolean enabled)
Enable or disable whether Opera should be launched on initialization.
|
void |
emulate(EmulationProfile profile)
Specify a prepared configuration for Opera Mobile to use.
|
void |
emulate(MobileDevices device)
Shorthand for
emulate(EmulationProfile). |
boolean |
equals(Object o) |
String |
getBackend()
Deprecated.
|
File |
getBinary()
Returns the browser binary executable.
|
Integer |
getDisplay()
Gets the X display used.
|
EmulationProfile |
getEmulationProfile()
Gets the mobile configuration specified in this settings object.
|
String |
getHost()
Returns the Scope server host the debugger should connect to.
|
File |
getLauncher()
Gets the launcher to use with
OperaLauncherRunner, if any. |
int |
getPort()
Gets the port the debugger should connect to.
|
OperaProduct |
getProduct()
Returns the product currently used, for example
OperaProduct.DESKTOP or OperaProduct.CORE. |
org.openqa.selenium.Proxy |
getProxy()
Returns current proxy settings
|
OperaRunner |
getRunner()
Get the runner to use for starting and managing the Opera instance.
|
boolean |
hasDetach()
Whether to detach the Opera browser when the driver shuts down.
|
OperaSettings.OperaLogging |
logging()
Returns the
OperaSettings.OperaLogging interface for managing logging levels and logging to file for
OperaDriver. |
OperaSettings |
merge(org.openqa.selenium.Capabilities capabilities)
Merge a set of capabilities in to these settings.
|
boolean |
noRestart()
Deprecated.
|
void |
noRestart(boolean enabled)
Deprecated.
|
OperaProfile |
profile()
Returns an
OperaProfile object containing all settings related to the Opera profile to
be used. |
void |
setBackend(String backend)
Deprecated.
|
void |
setBinary(File binary)
Sets Opera's binary executable location.
|
void |
setDetach(boolean enabled)
Specifies whether to detach the Opera browser when the driver shuts down.
|
void |
setDisplay(int display)
Sets the X display to use.
|
void |
setHost(String ip)
Specifies which Scope server the debugger should connect to.
|
void |
setIdle(boolean enabled)
Whether to use Opera's alternative implicit wait implementation.
|
void |
setLauncher(File launcherBinary)
Specifies launcher to use.
|
void |
setPort(int port)
Specifies the port the debugger should connect to.
|
void |
setProduct(OperaProduct product)
Sets the product currently used, for example desktop or core.
|
void |
setProfile(OperaProfile profile)
Sets the profile to use as an Opera profile represented as an object.
|
void |
setProfile(String profileDirectory)
Sets the directory to use for the Opera profile.
|
void |
setProxy(org.openqa.selenium.Proxy proxy)
Sets proxy settings
|
void |
setRunner(Class<? extends OperaRunner> runner)
Specify which runner to use for starting and managing the Opera instance.
|
boolean |
supportsDebugProxy()
Whether or not the currently specified Opera configuration supports the
-debugproxy command-line argument. |
boolean |
supportsPd()
Whether or not the currently specified Opera configuration supports the
-pd
command-line argument. |
org.openqa.selenium.Capabilities |
toCapabilities()
Returns this as capabilities.
|
org.json.JSONObject |
toJson()
Converts this instance to its JSON representation.
|
String |
toString()
String representation of the Opera specific settings.
|
boolean |
useIdle()
Whether to use Opera's alternative implicit wait implementation.
|
public OperaSettings()
OperaDriver and Opera to use. The default
settings are populated from OperaSettings.Capability.public OperaSettings(OperaProfile profile)
OperaDriver and Opera to use based on the given
profile.profile - the profile to usepublic OperaSettings.OperaLogging logging()
OperaSettings.OperaLogging interface for managing logging levels and logging to file for
OperaDriver.public File getBinary()
getProduct() (which defaults to OperaProduct.DESKTOP.public void setBinary(File binary)
getProduct() (which defaults to OperaProduct.DESKTOP.binary - the Opera binarypublic OperaArguments arguments()
public String getHost()
public void setHost(String ip)
ip - IP address (hostnames are not allowed) to the Scope serverpublic int getPort()
public void setPort(int port)
port - local port number for the debugger to connect topublic File getLauncher()
OperaLauncherRunner, if any. If autostart() is
false the launcher will not be used. If not set, this method will return the default location
of the launcher on your system.public void setLauncher(File launcherBinary) throws IOException
autostart() is false, it will not be used.launcherBinary - the launcher binaryIOException - if there is a problem with the provided launcherpublic OperaProfile profile()
OperaProfile object containing all settings related to the Opera profile to
be used. This might be anything from the path to the profile directory, to preferences used
in Opera.public void setProfile(String profileDirectory)
-debugproxy command-line argument will be
disabled for backwards compatibility reasons with older products, such as Opera < 11.60 and
core-mini.profileDirectory - the path to the profile directoryNullPointerException - if argument is nullpublic void setProfile(OperaProfile profile)
profile - the Opera profile to useNullPointerException - if argument is nullpublic boolean useIdle()
public void setIdle(boolean enabled)
enabled - to enable or disable idlepublic Integer getDisplay()
public void setDisplay(int display)
display - the X display to useUnsupportedOperationException - if on a non-GNU/Linux operating systempublic boolean autostart()
OperaDriver
will wait and listen for an incoming Scope client connection.public void autostart(boolean enabled)
OperaDriver will wait and listen for incoming an incoming Scope client connection. This
cannot be set during runtime. This is true by default.enabled - true if Opera should be started automatically, false otherwisepublic org.openqa.selenium.Proxy getProxy()
public void setProxy(org.openqa.selenium.Proxy proxy)
proxy - proxy settingspublic OperaProduct getProduct()
OperaProduct.DESKTOP or OperaProduct.CORE.public void setProduct(OperaProduct product)
product - the profile configuration to usepublic OperaRunner getRunner()
public void setRunner(Class<? extends OperaRunner> runner)
runner - the runner to use@Deprecated public boolean noRestart()
OperaDesktopDriver. It is false by default.@Deprecated public void noRestart(boolean enabled)
OperaDesktopDriver.enabled - true if Opera should be restart, false otherwisepublic boolean hasDetach()
public void setDetach(boolean enabled)
enabled - true will leave Opera running, false will shut down Opera along with driverpublic EmulationProfile getEmulationProfile()
public void emulate(MobileDevices device)
emulate(EmulationProfile). The EmulationProfile of the given
device will be extracted.device - the device to emulatepublic void emulate(EmulationProfile profile)
getProduct() must evaluate to OperaProduct.MOBILE.profile - the mobile configuration to use@Deprecated public String getBackend()
OperaLauncherRunner (i.e. if autostart() and getLauncher() are specified).
Warning: This is a temporary workaround for launcher not taking external
window-only screenshots on Windows.@Deprecated public void setBackend(String backend)
OperaLauncherRunner (i.e. if autostart() and getLauncher() are specified).
Warning: This is a temporary workaround for launcher not taking external
window-only screenshots on Windows.backend - the backend to use for gogi, either "software" or "hardware"public boolean supportsDebugProxy()
-debugproxy command-line argument. If the specified port is not equal to the
default proxy server port specified in OperaDefaults.SERVER_DEFAULT_PORT, this will be
true.-debugproxy command-line argument,
false otherwisepublic boolean supportsPd()
-pd
command-line argument. PD stands for personal directory, and refers to a
profile for Opera.-pd command-line argument.public OperaSettings merge(org.openqa.selenium.Capabilities capabilities)
opera. capability prefix will be updated, while surplus/unknown capabilities will
be stored. They can later be retrieved using the toCapabilities() method on this
object.capabilities - capabilities to merge into these settingspublic org.openqa.selenium.Capabilities toCapabilities()
public org.json.JSONObject toJson()
throws IOException,
org.json.JSONException
IOException - if an I/O error occursorg.json.JSONException - if an error occurs while encoding these settings as JSONCopyright © 2012. All Rights Reserved.