UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

32 lines 7.62 kB
<!DOCTYPE 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>DriverService</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="parentlink"><b>Module:</b> <a href="module_selenium-webdriver_remote.html">selenium-webdriver/remote</a></div><div class="codelink"><a href="source/remote/index.js.src.html#l364">View Source</a></div><h1>class DriverService</h1><p>Manages the life and death of a native executable WebDriver server.</p> <p>It is expected that the driver server implements the https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol. Furthermore, the managed server should support multiple concurrent sessions, so that this class may be reused for multiple clients.</p> <h3>new DriverService(<wbr>executable, options)</h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>executable<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>Path to the executable to run.</p> <dt>options<code>{args: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>&gt;|<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>), env: (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>&lt;<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>&gt;|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>), path: (<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/Undefined">undefined</a>), port: (<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>), stdio: (<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/Array">Array</a>&lt;?(<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/Number">number</a>|Stream)&gt;|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)}</code><dd><p>Configuration options for the service.</p> </dl></div></div><h2>Instance Methods</h2><div id="address" class="function"><div><h3>address()<span class="codelink"><a href="source/remote/index.js.src.html#l131">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code><dd><p>A promise that resolves to the server&#39;s address.</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 server has not been started.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="isRunning" class="function"><div><h3>isRunning()<span class="codelink"><a href="source/remote/index.js.src.html#l144">code »</a></span></h3><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.</p> <div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd><p>Whether the underlying service process is running.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="kill" class="function"><div><h3>kill()<span class="codelink"><a href="source/remote/index.js.src.html#l223">code »</a></span></h3><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 <a href="module_selenium-webdriver_remote_class_DriverService.html#stop"><code>#stop()</code></a>.</p> <div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code><dd><p>A promise that will be resolved when the server has been stopped.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="start" class="function"><div><h3>start(<wbr>opt_timeoutMs)<span class="codelink"><a href="source/remote/index.js.src.html#l158">code »</a></span></h3><p>Starts the server if it is not already running.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>opt_timeoutMs<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd><p>How long to wait, in milliseconds, for the server to start accepting requests. Defaults to 30 seconds.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code><dd><p>A promise that will resolve to the server&#39;s base URL when it has started accepting requests. If the timeout expires before the server has started, the promise will be rejected.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="stop" class="function"><div><h3>stop()<span class="codelink"><a href="source/remote/index.js.src.html#l239">code »</a></span></h3><p>Schedules a task in the current control flow to stop the server if it is currently running.</p> <div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code><dd><p>A promise that will be resolved when the server has been stopped.</p> </dl></div></div></div></div><h2>Static Properties</h2><div id="DriverService.DEFAULT_START_TIMEOUT_MS" class="property"><dl><dt><a href="source/remote/index.js.src.html#l123">DriverService.DEFAULT_START_TIMEOUT_MS</a><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd><p>The default amount of time, in milliseconds, to wait for the server to start.</p> </dl></div></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>