selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
62 lines (59 loc) • 6.49 kB
HTML
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"><meta http-equiv="Content-Language" content="en"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>selenium-webdriver/opera</title><link href="dossier.css" rel="stylesheet" type="text/css"><header><div><form><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></header><main><article><div class="codelink"><a href="source/opera.js.src.html#l73">View Source</a></div><h1>module selenium-webdriver/opera</h1><p>Defines a <a href="module_selenium-webdriver_opera_class_Driver.html">WebDriver</a> client for the
Opera web browser (v26+). Before using this module, you must download the
latest OperaDriver
<a href="https://github.com/operasoftware/operachromiumdriver/releases">release</a> and
ensure it can be found on your system
<a href="http://en.wikipedia.org/wiki/PATH_%28variable%29">PATH</a>.</p>
<p>There are three primary classes exported by this module:</p>
<ol><li>
<p><a href="module_selenium-webdriver_opera_class_ServiceBuilder.html">ServiceBuilder</a>: configures the
<a href="module_selenium-webdriver_remote_class_DriverService.html"><code>remote.DriverService</code></a>
that manages the
<a href="https://github.com/operasoftware/operachromiumdriver">OperaDriver</a>
child process.</p>
</li><li>
<p><a href="module_selenium-webdriver_opera_class_Options.html">Options</a>: defines configuration options for each new Opera
session, such as which <a href="module_selenium-webdriver_opera_class_Options.html#setProxy">proxy</a> to use,
what <a href="module_selenium-webdriver_opera_class_Options.html#addExtensions">extensions</a> to install, or
what <a href="module_selenium-webdriver_opera_class_Options.html#addArguments">command-line switches</a> to use when
starting the browser.</p>
</li><li>
<p><a href="module_selenium-webdriver_opera_class_Driver.html">Driver</a>: the WebDriver client; each new instance will control
a unique browser session with a clean user profile (unless otherwise
configured through the <a href="module_selenium-webdriver_opera_class_Options.html"><code>Options</code></a> class).</p>
</li></ol>
<p>By default, every Opera session will use a single driver service, which is
started the first time a <a href="module_selenium-webdriver_opera_class_Driver.html"><code>Driver</code></a> instance is created and terminated
when this process exits. The default service will inherit its environment
from the current process and direct all output to /dev/null. You may obtain
a handle to this default service using
<a href="module_selenium-webdriver_opera.html#getDefaultService"><code>getDefaultService()</code></a> and change its configuration
with <a href="module_selenium-webdriver_opera.html#setDefaultService"><code>setDefaultService()</code></a>.</p>
<p>You may also create a <a href="module_selenium-webdriver_opera_class_Driver.html"><code>Driver</code></a> with its own driver service. This is
useful if you need to capture the server's log output for a specific session:</p>
<pre><code>var opera = require('selenium-webdriver/opera');
var service = new opera.ServiceBuilder()
.loggingTo('/my/log/file.txt')
.enableVerboseLogging()
.build();
var options = new opera.Options();
// configure browser options ...
var driver = new opera.Driver(options, service);
</code></pre>
<p>Users should only instantiate the <a href="module_selenium-webdriver_opera_class_Driver.html"><code>Driver</code></a> class directly when they
need a custom driver service configuration (as shown above). For normal
operation, users should start Opera using the
<a href="module_selenium-webdriver_class_Builder.html"><code>selenium-webdriver.Builder</code></a>.</p>
<h2>Functions</h2><div id="getDefaultService" class="function"><div><h3>getDefaultService()<span class="codelink"><a href="source/opera.js.src.html#l498">code »</a></span></h3><p>Returns the default OperaDriver service. If such a service has not been
configured, one will be constructed using the default configuration for
a OperaDriver executable found on the system PATH.</p>
<div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_remote_class_DriverService.html">DriverService</a></code><dd><p>The default OperaDriver service.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="setDefaultService" class="function"><div><h3>setDefaultService(<wbr>service)<span class="codelink"><a href="source/opera.js.src.html#l499">code »</a></span></h3><p>Sets the default service to use for new OperaDriver instances.</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>service<code><a href="module_selenium-webdriver_remote_class_DriverService.html">DriverService</a></code><dd><p>The service to use.</p>
</dl></div><div class="fn-details"><div><b>Throws</b></div><dl><dt><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a></code><dd><p>If the default service is currently running.</p>
</dl></div></div></div></div><h2>Types</h2><dl><dt><a href="module_selenium-webdriver_opera_class_Driver.html">Driver</a><dd><p>Creates a new WebDriver client for Opera.</p>
<dt><a href="module_selenium-webdriver_opera_class_Options.html">Options</a><dd><p>Class for managing <a href="module_selenium-webdriver_opera_class_Driver.html"><code>OperaDriver</code></a> specific options.</p>
<dt><a href="module_selenium-webdriver_opera_class_ServiceBuilder.html">ServiceBuilder</a><dd><p>Creates <code>remote.DriverService</code> instances that manages an
<a href="https://github.com/operasoftware/operachromiumdriver">OperaDriver</a>
server in a child process.</p>
</dl></article><nav><h3><a href="index.html" tabindex="2">Overview</a></h3><div><input type="checkbox" id="nav-modules" checked/><label for="nav-modules"><h3><span class="selectable" tabindex="2">Modules</span></h3></label><div id="nav-modules-view"></div></div><div><input type="checkbox" id="nav-types" checked/><label for="nav-types"><h3><span class="selectable" tabindex="2">Types</span></h3></label><div id="nav-types-view"></div></div><h3><a href="Changes.html" tabindex="2">Changes</a></h3></nav></main><footer><div><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></div></footer><script src="types.js"></script><script src="dossier.js"></script>