selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
21 lines (20 loc) • 11.7 kB
HTML
<meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>DriverService</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class DriverService</h1><a class="source" href="source/remote/index.js.src.html#l300">code »</a></header><section><p>Manages the life and death of a native executable WebDriver server.
<p>It is expected that the driver server implements the
<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol">WebDriver
Wire Protocol</a>. Furthermore, the managed server should support multiple
concurrent sessions, so that this class may be reused for multiple clients.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">DriverService <span class="args">( executable, options )</span></span></div><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>executable: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Path to the executable to run.<dt>options: <code class="type">!ServiceOptions</code><dd>Configuration options for the service.</dl></table></div></div></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/remote/index.js.src.html#l128">code »</a><span class="member"><a name="address">address</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A promise that resolves to
the server's address.</dl><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>If the server has not been started.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/remote/index.js.src.html#l141">code »</a><span class="member"><a name="isRunning">isRunning</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether the underlying process is still running. This does not take
into account whether the process is in the process of shutting down.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Whether the underlying service process is running.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/remote/index.js.src.html#l211">code »</a><span class="member"><a name="kill">kill</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code></span></div><p>Stops the service if it is not currently running. This function will kill
the server immediately. To synchronize with the active control flow, use
<code class="type"><a class="unresolved-link">#stop()</a></code>.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A promise that will be resolved when
the server has been stopped.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/remote/index.js.src.html#l155">code »</a><span class="member"><a name="start">start</a> <span class="args">( opt_timeoutMs )</span> ⇒ <code class="type">!promise.Promise.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div><p>Starts the server if it is not already running.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_timeoutMs: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>How long to wait, in milliseconds, for the
server to start accepting requests. Defaults to 30 seconds.</dl><tr><th>Returns<tr><td><dl>A promise that will resolve
to the server's base URL when it has started accepting requests. If the
timeout expires before the server has started, the promise will be
rejected.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/remote/index.js.src.html#l227">code »</a><span class="member"><a name="stop">stop</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code></span></div><p>Schedules a task in the current control flow to stop the server if it is
currently running.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A promise that will be resolved when
the server has been stopped.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l111">code »</a><span class="member"><a name="address_">address_</a> : <code class="type">promise.Promise.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div><p>Promise that resolves to the server's address or null if the server has
not been started. This promise will be rejected if the server terminates
before it starts accepting WebDriver requests.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l87">code »</a><span class="member"><a name="args_">args_</a> : <code class="type">!(<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>|<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>)</code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l103">code »</a><span class="member"><a name="command_">command_</a> : <code class="type">promise.Promise</code></span></div><p>A promise for the managed subprocess, or null if the server has not been
started yet. This promise will never be rejected.</summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l93">code »</a><span class="member"><a name="env_">env_</a> : <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l76">code »</a><span class="member"><a name="executable_">executable_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l79">code »</a><span class="member"><a name="loopbackOnly_">loopbackOnly_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l90">code »</a><span class="member"><a name="path_">path_</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l82">code »</a><span class="member"><a name="port_">port_</a> : <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>|!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>.<<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>>)</code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l96">code »</a><span class="member"><a name="stdio_">stdio_</a> : <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>)</code></span></div></summary></details></div></div></section><section id="static-properties"><h2>Static Properties</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/remote/index.js.src.html#l120">code »</a><span class="member"><a name="DriverService.DEFAULT_START_TIMEOUT_MS">DriverService.DEFAULT_START_TIMEOUT_MS</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>The default amount of time, in milliseconds, to wait for the server to
start.</summary></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>Loading</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>Loading</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>Loading</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>