UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

46 lines 9.75 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>ServiceBuilder</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_chrome.html">selenium-webdriver/chrome</a></div><div class="codelink"><a href="source/chrome.js.src.html#l846">View Source</a></div><h1>class ServiceBuilder</h1><p>Creates <a href="module_selenium-webdriver_remote_class_DriverService.html"><code>selenium-webdriver/remote.DriverService</code></a> instances that manage a <a href="https://sites.google.com/a/chromium.org/chromedriver/">ChromeDriver</a> server in a child process.</p> <h3>new ServiceBuilder(<wbr>opt_exe)</h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>opt_exe<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd><p>Path to the server executable to use. If omitted, the builder will attempt to locate the chromedriver on the current PATH.</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 provided executable does not exist, or the chromedriver cannot be found on the PATH.</p> </dl></div></div><h2>Instance Methods</h2><div id="build" class="function"><div><h3>build()<span class="codelink"><a href="source/chrome.js.src.html#l319">code »</a></span></h3><p>Creates a new DriverService using this instance&#39;s current configuration.</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>A new driver service using this instance&#39;s current configuration.</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 driver exectuable was not specified and a default could not be found on the current PATH.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="enableVerboseLogging" class="function"><div><h3>enableVerboseLogging()<span class="codelink"><a href="source/chrome.js.src.html#l256">code »</a></span></h3><p>Enables verbose logging.</p> <div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="loggingTo" class="function"><div><h3>loggingTo(<wbr>path)<span class="codelink"><a href="source/chrome.js.src.html#l246">code »</a></span></h3><p>Sets the path of the log file the driver should log to. If a log file is not specified, the driver will log to stderr.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>path<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>Path of the log file to use.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setAdbPort" class="function"><div><h3>setAdbPort(<wbr>port)<span class="codelink"><a href="source/chrome.js.src.html#l234">code »</a></span></h3><p>Sets which port adb is listening to. <em>The ChromeDriver will connect to adb if an <a href="module_selenium-webdriver_chrome_class_Options.html#androidPackage">Android session</a> is requested, but adb <strong>must</strong> be started beforehand.</em></p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>port<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd><p>Which port adb is running on.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setNumHttpThreads" class="function"><div><h3>setNumHttpThreads(<wbr>n)<span class="codelink"><a href="source/chrome.js.src.html#l268">code »</a></span></h3><p>Sets the number of threads the driver should use to manage HTTP requests. By default, the driver will use 4 threads.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>n<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd><p>The number of threads to use.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setStdio" class="function"><div><h3>setStdio(<wbr>config)<span class="codelink"><a href="source/chrome.js.src.html#l294">code »</a></span></h3><p>Defines the stdio configuration for the driver service. See <code>child_process.spawn</code> for more information.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>config<code>(<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;)</code><dd><p>The configuration to use.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setUrlBasePath" class="function"><div><h3>setUrlBasePath(<wbr>path)<span class="codelink"><a href="source/chrome.js.src.html#l280">code »</a></span></h3><p>Sets the base path for WebDriver REST commands (e.g. &#34;/wd/hub&#34;). By default, the driver will accept commands relative to &#34;/&#34;.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>path<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The base path to use.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="usingPort" class="function"><div><h3>usingPort(<wbr>port)<span class="codelink"><a href="source/chrome.js.src.html#l217">code »</a></span></h3><p>Sets the port to start the ChromeDriver on.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>port<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd><p>The port to use, or 0 for any free port.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</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 port is invalid.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="withEnvironment" class="function"><div><h3>withEnvironment(<wbr>env)<span class="codelink"><a href="source/chrome.js.src.html#l306">code »</a></span></h3><p>Defines the environment to start the server under. This settings will be inherited by every browser session started by the server.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>env<code><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;</code><dd><p>The environment to use.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="module_selenium-webdriver_chrome_class_ServiceBuilder.html">ServiceBuilder</a></code><dd><p>A self reference.</p> </dl></div></div></div></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>