public class OperaProfile extends Object
OperaDriver, like this:
DesiredCapabilities capabilities = DesiredCapabilities.opera();
OperaProfile profile = new OperaProfile();
profile.preferences().set("foo", "bar", "baz");
capabilities.setCapability("opera.profile", profile);
WebDriver driver = new OperaDriver(capabilities);
Or by passing it in as an object directly to OperaDriver's constructor:
OperaProfile profile = new OperaProfile();
profile.preferences().set("foo", "bar", "baz");
WebDriver driver = new OperaDriver(profile);
Among Opera's command-line arguments the profile may be referred to as "pd", short for "personal
directory".OperaPreferences| Modifier and Type | Field and Description |
|---|---|
static String |
BASE64_JSON_KEY |
| Constructor and Description |
|---|
OperaProfile()
Creates a new, fresh random profile for Opera to use.
|
OperaProfile(File profileDirectory)
Creates a representation of the profile in the given directory.
|
OperaProfile(String profileDirectoryPath)
Creates a representation of the profile in the given directory path.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp()
Cleans up the profile.
|
static OperaProfile |
fromJson(String json)
Converts a JSON string object to a profile representation, returning a new instance of
OperaProfile. |
File |
getDirectory()
Gets the current profile directory.
|
OperaPreferences |
preferences()
Allows access to the preferences in the current profile.
|
void |
setPreferences(OperaPreferences newPreferences)
Replaces the preferences in the profile with the given preferences.
|
org.json.JSONObject |
toJson()
Converts this instance to its JSON representation.
|
public static final String BASE64_JSON_KEY
public OperaProfile()
-pd command-line argument, such as
Opera Desktop. core-gogi and Opera Mobile is not supported.public OperaProfile(String profileDirectoryPath)
profileDirectoryPath - the path to the profile directory to usepublic OperaProfile(File profileDirectory)
profileDirectory - the profile to useIllegalArgumentException - if profileDirectory is not setpublic OperaPreferences preferences()
OperaPreferences object representing preferences in the current profilepublic void setPreferences(OperaPreferences newPreferences)
newPreferences - the new preferences to populate the profile withpublic File getDirectory()
public void cleanUp()
public org.json.JSONObject toJson()
throws IOException
IOException - if an I/O error occurspublic static OperaProfile fromJson(String json) throws IOException
OperaProfile. This is used by the JsonWireProtocol to transfer a profile.json - a base64-encoded JSON string (archive) representing a profileIOException - if an I/O error occursCopyright © 2012. All Rights Reserved.