--- /dev/null
+<!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>WebDriver</title><link href="dossier.css" rel="stylesheet" type="text/css"><header><div><form><div><input type="search" placeholder="Search"></div></form></div></header><main><article><div class="parentlink"><b>Module:</b> <a href="module_selenium-webdriver.html">selenium-webdriver</a></div><div class="codelink"><a href="source/index.js.src.html#l68">View Source</a></div><h1>class WebDriver</h1><dl><dt>Alias for <code><a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a></code></dl><p>Creates a new WebDriver client, which provides control over a browser.</p><p>Every WebDriver command returns a <code>webdriver.promise.Promise</code> that represents the result of that command. Callbacks may be registered on this object to manipulate the command result or catch an expected error. Any commands scheduled with a callback are considered sub-commands and will execute before the next command in the current frame. For example:</p>
+<pre><code>var message = [];
+driver.call(message.push, message, 'a').then(function() {
+ driver.call(message.push, message, 'b');
+});
+driver.call(message.push, message, 'c');
+driver.call(function() {
+ alert('message is abc? ' + (message.join('') == 'abc'));
+});
+</code></pre><h2 class="main">new WebDriver(<wbr>session, executor, opt_flow)</h2><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>session<code>(<a href="class_webdriver_Session.html">webdriver.Session</a>|<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>)</code><dd><p>Either a known session or a promise that will be resolved to a session.</p><dt>executor<code><a href="interface_webdriver_CommandExecutor.html">webdriver.CommandExecutor</a></code><dd><p>The executor to use when sending commands to the browser.</p><dt>opt_flow<code>?<a href="class_webdriver_promise_ControlFlow.html">webdriver.promise.ControlFlow</a>=</code><dd><p>The flow to schedule commands through. Defaults to the active flow object.</p></dl></div></div><h2>Instance Methods</h2><div id="actions" class="function"><div><h3>actions()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l467">code »</a></span></h3><p>Creates a new action sequence using this driver. The sequence will not be scheduled for execution until <a href="class_webdriver_ActionSequence.html#perform"><code>webdriver.ActionSequence#perform</code></a> is called. Example:</p>
+<pre><code>driver.actions().
+ mouseDown(element1).
+ mouseMove(element2).
+ mouseUp().
+ perform();
+</code></pre><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code><dd><p>A new action sequence for this instance.</p></dl></div></div></div></div><hr class="fn-sep"><div id="call" class="function"><div><h3><code><T></code> call(<wbr>fn, opt_scope, var_args)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l637">code »</a></span></h3><p>Schedules a command to execute a custom function.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>fn<code>function(...?): (T|<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a><T>)</code><dd><p>The function to execute.</p><dt>opt_scope<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd><p>The object in whose scope to execute the function.</p><dt>var_args<code>...*</code><dd><p>Any arguments to pass to the function.</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><T></code><dd><p>A promise that will be resolved' with the function's result.</p></dl></div></div></div></div><hr class="fn-sep"><div id="close" class="function"><div><h3>close()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l778">code »</a></span></h3><p>Schedules a command to close the current window.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>></code><dd><p>A promise that will be resolved when this command has completed.</p></dl></div></div></div></div><hr class="fn-sep"><div id="controlFlow" class="function"><div><h3>controlFlow()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l322">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_promise_ControlFlow.html">webdriver.promise.ControlFlow</a></code><dd><p>The control flow used by this instance.</p></dl></div></div></div></div><hr class="fn-sep"><div id="executeAsyncScript" class="function"><div><h3><code><T></code> executeAsyncScript(<wbr>script, var_args)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l615">code »</a></span></h3><p>Schedules a command to execute asynchronous JavaScript in the context of the currently selected frame or window. The script fragment will be executed as the body of an anonymous function. If the script is provided as a function object, that function will be converted to a string for injection into the target window.</p><p>Any arguments provided in addition to the script will be included as script arguments and may be referenced using the <code>arguments</code> object. Arguments may be a boolean, number, string, or <code>webdriver.WebElement</code>. Arrays and objects may also be used as script arguments as long as each item adheres to the types previously mentioned.</p><p>Unlike executing synchronous JavaScript with <a href="module_selenium-webdriver_class_WebDriver.html#executeScript"><code>#executeScript</code></a>, scripts executed with this function must explicitly signal they are finished by invoking the provided callback. This callback will always be injected into the executed function as the last argument, and thus may be referenced with <code>arguments[arguments.length - 1]</code>. The following steps will be taken for resolving this functions return value against the first argument to the script's callback function:</p>
+<ul><li>For a HTML element, the value will resolve to a <a href="class_webdriver_WebElement.html"><code>webdriver.WebElement</code></a></li><li>Null and undefined return values will resolve to null</li><li>Booleans, numbers, and strings will resolve as is</li><li>Functions will resolve to their string representation</li><li>For arrays and objects, each member item will be converted according to the rules above</li></ul><p><strong>Example #1:</strong> Performing a sleep that is synchronized with the currently selected window:</p>
+<pre><code>var start = new Date().getTime();
+driver.executeAsyncScript(
+ 'window.setTimeout(arguments[arguments.length - 1], 500);').
+ then(function() {
+ console.log(
+ 'Elapsed time: ' + (new Date().getTime() - start) + ' ms');
+ });
+</code></pre><p><strong>Example #2:</strong> Synchronizing a test with an AJAX application:</p>
+<pre><code>var button = driver.findElement(By.id('compose-button'));
+button.click();
+driver.executeAsyncScript(
+ 'var callback = arguments[arguments.length - 1];' +
+ 'mailClient.getComposeWindowWidget().onload(callback);');
+driver.switchTo().frame('composeWidget');
+driver.findElement(By.id('to')).sendKeys('dog@example.com');
+</code></pre><p><strong>Example #3:</strong> Injecting a XMLHttpRequest and waiting for the result. In this example, the inject script is specified with a function literal. When using this format, the function is converted to a string for injection, so it should not reference any symbols not defined in the scope of the page under test.</p>
+<pre><code>driver.executeAsyncScript(function() {
+ var callback = arguments[arguments.length - 1];
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "/resource/data.json", true);
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ callback(xhr.responseText);
+ }
+ }
+ xhr.send('');
+}).then(function(str) {
+ console.log(JSON.parse(str)['food']);
+});
+</code></pre><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>script<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|Function)</code><dd><p>The script to execute.</p><dt>var_args<code>...*</code><dd><p>The arguments to pass to the script.</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><T></code><dd><p>A promise that will resolve to the scripts return value.</p></dl></div></div></div></div><hr class="fn-sep"><div id="executeScript" class="function"><div><h3><code><T></code> executeScript(<wbr>script, var_args)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l526">code »</a></span></h3><p>Schedules a command to execute JavaScript in the context of the currently selected frame or window. The script fragment will be executed as the body of an anonymous function. If the script is provided as a function object, that function will be converted to a string for injection into the target window.</p><p>Any arguments provided in addition to the script will be included as script arguments and may be referenced using the <code>arguments</code> object. Arguments may be a boolean, number, string, or <code>webdriver.WebElement</code>. Arrays and objects may also be used as script arguments as long as each item adheres to the types previously mentioned.</p><p>The script may refer to any variables accessible from the current window. Furthermore, the script will execute in the window's context, thus <code>document</code> may be used to refer to the current document. Any local variables will not be available once the script has finished executing, though global variables will persist.</p><p>If the script has a return value (i.e. if the script contains a return statement), then the following steps will be taken for resolving this functions return value:</p>
+<ul><li>For a HTML element, the value will resolve to a <a href="class_webdriver_WebElement.html"><code>webdriver.WebElement</code></a></li><li>Null and undefined return values will resolve to null</li><li>Booleans, numbers, and strings will resolve as is</li><li>Functions will resolve to their string representation</li><li>For arrays and objects, each member item will be converted according to the rules above</li></ul><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>script<code>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|Function)</code><dd><p>The script to execute.</p><dt>var_args<code>...*</code><dd><p>The arguments to pass to the script.</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><T></code><dd><p>A promise that will resolve to the scripts return value.</p></dl></div></div></div></div><hr class="fn-sep"><div id="findElement" class="function"><div><h3>findElement(<wbr>locator)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l865">code »</a></span></h3><p>Schedule a command to find an element on the page. If the element cannot be found, a <a href="enum_bot_ErrorCode.html#NO_SUCH_ELEMENT"><code>bot.ErrorCode.NO_SUCH_ELEMENT</code></a> result will be returned by the driver. Unlike other commands, this error cannot be suppressed. In other words, scheduling a command to find an element doubles as an assert that the element is present on the page. To test whether an element is present on the page, use <a href="module_selenium-webdriver_class_WebDriver.html#isElementPresent"><code>#isElementPresent</code></a> instead.</p><p>The search criteria for an element may be defined using one of the factories in the <a href="namespace_webdriver_By.html"><code>webdriver.By</code></a> namespace, or as a short-hand <a href="namespace_webdriver_By.html#By.Hash"><code>webdriver.By.Hash</code></a> object. For example, the following two statements are equivalent:</p>
+<pre><code>var e1 = driver.findElement(By.id('foo'));
+var e2 = driver.findElement({id:'foo'});
+</code></pre><p>You may also provide a custom locator function, which takes as input this WebDriver instance and returns a <a href="class_webdriver_WebElement.html"><code>webdriver.WebElement</code></a>, or a promise that will resolve to a WebElement. For example, to find the first visible link on a page, you could write:</p>
+<pre><code>var link = driver.findElement(firstVisibleLink);
+
+function firstVisibleLink(driver) {
+ var links = driver.findElements(By.tagName('a'));
+ return webdriver.promise.filter(links, function(link) {
+ return links.isDisplayed();
+ }).then(function(visibleLinks) {
+ return visibleLinks[0];
+ });
+}
+</code></pre><p>When running in the browser, a WebDriver cannot manipulate DOM elements directly; it may do so only through a <a href="class_webdriver_WebElement.html"><code>webdriver.WebElement</code></a> reference. This function may be used to generate a WebElement from a DOM element. A reference to the DOM element will be stored in a known location and this driver will attempt to retrieve it through <a href="module_selenium-webdriver_class_WebDriver.html#executeScript"><code>#executeScript</code></a>. If the element cannot be found (eg, it belongs to a different document than the one this instance is currently focused on), a <a href="enum_bot_ErrorCode.html#NO_SUCH_ELEMENT"><code>bot.ErrorCode.NO_SUCH_ELEMENT</code></a> error will be returned.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>locator<code>(<a href="class_webdriver_Locator.html">webdriver.Locator</a>|{className: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{css: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{id: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{js: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{linkText: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{name: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{partialLinkText: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{tagName: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{xpath: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>})</code><dd><p>The locator to use.</p></dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code><dd><p>A WebElement that can be used to issue commands against the located element. If the element is not found, the element will be invalidated and all scheduled commands aborted.</p></dl></div></div></div></div><hr class="fn-sep"><div id="findElements" class="function"><div><h3>findElements(<wbr>locator)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l992">code »</a></span></h3><p>Schedule a command to search for multiple elements on the page.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>locator<code>(<a href="class_webdriver_Locator.html">webdriver.Locator</a>|{className: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{css: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{id: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{js: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{linkText: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{name: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{partialLinkText: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{tagName: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{xpath: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>})</code><dd><p>The locator strategy to use when searching for the element.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a><<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>>></code><dd><p>A promise that will resolve to an array of WebElements.</p></dl></div></div></div></div><hr class="fn-sep"><div id="get" class="function"><div><h3>get(<wbr>url)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l790">code »</a></span></h3><p>Schedules a command to navigate to the given URL.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>url<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The fully qualified URL to open.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>></code><dd><p>A promise that will be resolved when the document has finished loading.</p></dl></div></div></div></div><hr class="fn-sep"><div id="getAllWindowHandles" class="function"><div><h3>getAllWindowHandles()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l751">code »</a></span></h3><p>Schedules a command to retrieve the current list of available window handles.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>></code><dd><p>A promise that will be resolved with an array of window handles.</p></dl></div></div></div></div><hr class="fn-sep"><div id="getCapabilities" class="function"><div><h3>getCapabilities()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l428">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><<a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a>></code><dd><p>A promise that will resolve with the this instance's capabilities.</p></dl></div></div></div></div><hr class="fn-sep"><div id="getCurrentUrl" class="function"><div><h3>getCurrentUrl()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l800">code »</a></span></h3><p>Schedules a command to retrieve the URL of the current page.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code><dd><p>A promise that will be resolved with the current URL.</p></dl></div></div></div></div><hr class="fn-sep"><div id="getPageSource" class="function"><div><h3>getPageSource()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l766">code »</a></span></h3><p>Schedules a command to retrieve the current page's source. The page source returned is a representation of the underlying DOM: do not expect it to be formatted or escaped in the same way as the response sent from the web server.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code><dd><p>A promise that will be resolved with the current page source.</p></dl></div></div></div></div><hr class="fn-sep"><div id="getSession" class="function"><div><h3>getSession()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l419">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><<a href="class_webdriver_Session.html">webdriver.Session</a>></code><dd><p>A promise for this client's session.</p></dl></div></div></div></div><hr class="fn-sep"><div id="getTitle" class="function"><div><h3>getTitle()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l812">code »</a></span></h3><p>Schedules a command to retrieve the current page's title.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code><dd><p>A promise that will be resolved with the current page's title.</p></dl></div></div></div></div><hr class="fn-sep"><div id="getWindowHandle" class="function"><div><h3>getWindowHandle()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l739">code »</a></span></h3><p>Schedules a command to retrieve they current window handle.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code><dd><p>A promise that will be resolved with the current window handle.</p></dl></div></div></div></div><hr class="fn-sep"><div id="isElementPresent" class="function"><div><h3>isElementPresent(<wbr>locatorOrElement)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l972">code »</a></span></h3><p>Schedules a command to test if an element is present on the page.</p><p>If given a DOM element, this function will check if it belongs to the document the driver is currently focused on. Otherwise, the function will test if at least one element can be found with the given search criteria.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>locatorOrElement<code>(<a href="class_webdriver_Locator.html">webdriver.Locator</a>|{className: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{css: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{id: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{js: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{linkText: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{name: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{partialLinkText: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{tagName: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}|{xpath: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>})</code><dd><p>The locator to use, or the actual DOM element to be located by the server.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>></code><dd><p>A promise that will resolve with whether the element is present on the page.</p></dl></div></div></div></div><hr class="fn-sep"><div id="manage" class="function"><div><h3>manage()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l1054">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_WebDriver_Options.html">webdriver.WebDriver.Options</a></code><dd><p>The options interface for this instance.</p></dl></div></div></div></div><hr class="fn-sep"><div id="navigate" class="function"><div><h3>navigate()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l1063">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_WebDriver_Navigation.html">webdriver.WebDriver.Navigation</a></code><dd><p>The navigation interface for this instance.</p></dl></div></div></div></div><hr class="fn-sep"><div id="quit" class="function"><div><h3>quit()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l442">code »</a></span></h3><p>Schedules a command to quit the current session. After calling quit, this instance will be invalidated and may no longer be used to issue commands against the browser.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>></code><dd><p>A promise that will be resolved when the command has completed.</p></dl></div></div></div></div><hr class="fn-sep"><div id="schedule" class="function"><div><h3><code><T></code> schedule(<wbr>command, description)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l336">code »</a></span></h3><p>Schedules a <code>webdriver.Command</code> to be executed by this driver's <code>webdriver.CommandExecutor</code>.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>command<code><a href="class_webdriver_Command.html">webdriver.Command</a></code><dd><p>The command to schedule.</p><dt>description<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>A description of the command for debugging.</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><T></code><dd><p>A promise that will be resolved with the command result.</p></dl></div></div></div></div><hr class="fn-sep"><div id="setFileDetector" class="function"><div><h3>setFileDetector(<wbr>detector)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l405">code »</a></span></h3><p>Sets the <a href="class_webdriver_FileDetector.html">file detector</a> that should be used with this instance.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>detector<code><a href="class_webdriver_FileDetector.html">webdriver.FileDetector</a></code><dd><p>The detector to use or <code>null</code>.</p></dl></div></div></div></div><hr class="fn-sep"><div id="sleep" class="function"><div><h3>sleep(<wbr>ms)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l729">code »</a></span></h3><p>Schedules a command to make the driver sleep for the given amount of time.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>ms<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd><p>The amount of time, in milliseconds, to sleep.</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><<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>></code><dd><p>A promise that will be resolved when the sleep has finished.</p></dl></div></div></div></div><hr class="fn-sep"><div id="switchTo" class="function"><div><h3>switchTo()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l1072">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_WebDriver_TargetLocator.html">webdriver.WebDriver.TargetLocator</a></code><dd><p>The target locator interface for this instance.</p></dl></div></div></div></div><hr class="fn-sep"><div id="takeScreenshot" class="function"><div><h3>takeScreenshot()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l1044">code »</a></span></h3><p>Schedule a command to take a screenshot. The driver makes a best effort to return a screenshot of the following, in order of preference: </p><ol><li>Entire page </li><li>Current window </li><li>Visible portion of the current frame </li><li>The screenshot of the entire display containing the browser </li></ol><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><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><dd><p>A promise that will be resolved to the screenshot as a base-64 encoded PNG.</p></dl></div></div></div></div><hr class="fn-sep"><div id="touchActions" class="function"><div><h3>touchActions()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l484">code »</a></span></h3><p>Creates a new touch sequence using this driver. The sequence will not be scheduled for execution until <a href="class_webdriver_TouchSequence.html#perform"><code>webdriver.TouchSequence#perform</code></a> is called. Example:</p>
+<pre><code>driver.touchActions().
+ tap(element1).
+ doubleTap(element2).
+ perform();
+</code></pre><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_TouchSequence.html">webdriver.TouchSequence</a></code><dd><p>A new touch sequence for this instance.</p></dl></div></div></div></div><hr class="fn-sep"><div id="wait" class="function"><div><h3><code><T></code> wait(<wbr>condition, opt_timeout, opt_message)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l698">code »</a></span></h3><p>Schedules a command to wait for a condition to hold. The condition may be specified by a <a href="class_webdriver_until_Condition.html"><code>webdriver.until.Condition</code></a>, as a custom function, or as a <a href="class_webdriver_promise_Promise.html"><code>webdriver.promise.Promise</code></a>.</p><p>For a <a href="class_webdriver_until_Condition.html"><code>webdriver.until.Condition</code></a> or function, the wait will repeatedly evaluate the condition until it returns a truthy value. If any errors occur while evaluating the condition, they will be allowed to propagate. In the event a condition returns a <a href="class_webdriver_promise_Promise.html"><code>promise</code></a>, the polling loop will wait for it to be resolved and use the resolved value for whether the condition has been satisified. Note the resolution time for a promise is factored into whether a wait has timed out.</p><p><em>Example:</em> waiting up to 10 seconds for an element to be present and visible on the page.</p>
+<pre><code>var button = driver.wait(until.elementLocated(By.id('foo'), 10000);
+button.click();
+</code></pre><p>This function may also be used to block the command flow on the resolution of a <a href="class_webdriver_promise_Promise.html"><code>promise</code></a>. When given a promise, the command will simply wait for its resolution before completing. A timeout may be provided to fail the command if the promise does not resolve before the timeout expires.</p><p><em>Example:</em> Suppose you have a function, <code>startTestServer</code>, that returns a promise for when a server is ready for requests. You can block a <code>WebDriver</code> client on this promise with:</p>
+<pre><code>var started = startTestServer();
+driver.wait(started, 5 * 1000, 'Server should start within 5 seconds');
+driver.get(getServerUrl());
+</code></pre><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>condition<code>(<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a><T>|<a href="class_webdriver_until_Condition.html">webdriver.until.Condition</a><T>|function(<a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a>): T)</code><dd><p>The condition to wait on, defined as a promise, condition object, or a function to evaluate as a condition.</p><dt>opt_timeout<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 for the condition to be true.</p><dt>opt_message<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd><p>An optional message to use if the wait times out.</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><T></code><dd><p>A promise that will be fulfilled with the first truthy value returned by the condition function, or rejected if the condition times out.</p></dl></div></div></div></div><h2>Static Functions</h2><div id="WebDriver.attachToSession" class="function"><div><h3>WebDriver.attachToSession(<wbr>executor, sessionId, opt_flow)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l106">code »</a></span></h3><p>Creates a new WebDriver client for an existing session.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>executor<code><a href="interface_webdriver_CommandExecutor.html">webdriver.CommandExecutor</a></code><dd><p>Command executor to use when querying for session details.</p><dt>sessionId<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>ID of the session to attach to.</p><dt>opt_flow<code>?<a href="class_webdriver_promise_ControlFlow.html">webdriver.promise.ControlFlow</a>=</code><dd><p>The control flow all driver commands should execute under. Defaults to the <a href="namespace_webdriver_promise.html#controlFlow"><code>currently active</code></a> control flow.</p></dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a></code><dd><p>A new client for the specified session.</p></dl></div></div></div></div><hr class="fn-sep"><div id="WebDriver.createSession" class="function"><div><h3>WebDriver.createSession(<wbr>executor, desiredCapabilities, opt_flow)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l127">code »</a></span></h3><p>Creates a new WebDriver session.</p><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>executor<code><a href="interface_webdriver_CommandExecutor.html">webdriver.CommandExecutor</a></code><dd><p>The executor to create the new session with.</p><dt>desiredCapabilities<code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>The desired capabilities for the new session.</p><dt>opt_flow<code>?<a href="class_webdriver_promise_ControlFlow.html">webdriver.promise.ControlFlow</a>=</code><dd><p>The control flow all driver commands should execute under, including the initial session creation. Defaults to the <a href="namespace_webdriver_promise.html#controlFlow"><code>currently active</code></a> control flow.</p></dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a></code><dd><p>The driver for the newly created session.</p></dl></div></div></div></div><h2>Types</h2><dl><dt><a href="class_webdriver_WebDriver_Logs.html">WebDriver.Logs</a><dd><p>Interface for managing WebDriver log records.</p><dt><a href="class_webdriver_WebDriver_Navigation.html">WebDriver.Navigation</a><dd><p>Interface for navigating back and forth in the browser history.</p><dt><a href="class_webdriver_WebDriver_Options.html">WebDriver.Options</a><dd><p>Provides methods for managing browser and driver state.</p><dt><a href="class_webdriver_WebDriver_TargetLocator.html">WebDriver.TargetLocator</a><dd><p>An interface for changing the focus of the driver to another frame or window.</p><dt><a href="class_webdriver_WebDriver_Timeouts.html">WebDriver.Timeouts</a><dd><p>An interface for managing timeout behavior for WebDriver instances.</p><dt><a href="class_webdriver_WebDriver_Window.html">WebDriver.Window</a><dd><p>An interface for managing the current window.</p></dl></article><nav><h3><a href="index.html">Overview</a></h3><div><input type="checkbox" id="nav-modules" checked/><label for="nav-modules"><h3>Modules</h3></label><div><ul><li><a href="module_selenium-webdriver.html">selenium-webdriver</a><li><a href="module_selenium-webdriver__base.html">selenium-webdriver/_base</a><li><a href="module_selenium-webdriver_builder.html">selenium-webdriver/builder</a><li><a href="module_selenium-webdriver_chrome.html">selenium-webdriver/chrome</a><li><a href="module_selenium-webdriver_error.html">selenium-webdriver/error</a><li><a href="module_selenium-webdriver_executors.html">selenium-webdriver/executors</a><li><a href="module_selenium-webdriver_firefox.html">selenium-webdriver/firefox</a><li><a href="module_selenium-webdriver_firefox_binary.html">selenium-webdriver/firefox/binary</a><li><a href="module_selenium-webdriver_firefox_extension.html">selenium-webdriver/firefox/extension</a><li><a href="module_selenium-webdriver_firefox_profile.html">selenium-webdriver/firefox/profile</a><li><a href="module_selenium-webdriver_http.html">selenium-webdriver/http</a><li><a href="module_selenium-webdriver_http_util.html">selenium-webdriver/http/util</a><li><a href="module_selenium-webdriver_ie.html">selenium-webdriver/ie</a><li><a href="module_selenium-webdriver_io.html">selenium-webdriver/io</a><li><a href="module_selenium-webdriver_io_exec.html">selenium-webdriver/io/exec</a><li><a href="module_selenium-webdriver_net.html">selenium-webdriver/net</a><li><a href="module_selenium-webdriver_net_portprober.html">selenium-webdriver/net/portprober</a><li><a href="module_selenium-webdriver_opera.html">selenium-webdriver/opera</a><li><a href="module_selenium-webdriver_phantomjs.html">selenium-webdriver/phantomjs</a><li><a href="module_selenium-webdriver_proxy.html">selenium-webdriver/proxy</a><li><a href="module_selenium-webdriver_remote.html">selenium-webdriver/remote</a><li><a href="module_selenium-webdriver_safari.html">selenium-webdriver/safari</a><li><a href="module_selenium-webdriver_testing.html">selenium-webdriver/testing</a><li><a href="module_selenium-webdriver_testing_assert.html">selenium-webdriver/testing/assert</a></ul></div></div><div><input type="checkbox" id="nav-types" checked/><label for="nav-types"><h3>Types</h3></label><div><ul><li><a href="namespace_bot.html">bot</a><li><a href="class_bot_Error.html">bot.Error</a><li><a href="enum_bot_Error_State.html">bot.Error.State</a><li><a href="enum_bot_ErrorCode.html">bot.ErrorCode</a><li><a href="namespace_bot_json.html">bot.json</a><li><a href="namespace_bot_response.html">bot.response</a><li><a href="namespace_bot_userAgent.html">bot.userAgent</a><li><a href="namespace_webdriver.html">webdriver</a><li><a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a><li><a href="class_webdriver_Alert.html">webdriver.Alert</a><li><a href="class_webdriver_AlertPromise.html">webdriver.AlertPromise</a><li><a href="enum_webdriver_Browser.html">webdriver.Browser</a><li><a href="enum_webdriver_Button.html">webdriver.Button</a><li><a href="namespace_webdriver_By.html">webdriver.By</a><li><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a><li><a href="enum_webdriver_Capability.html">webdriver.Capability</a><li><a href="class_webdriver_Command.html">webdriver.Command</a><li><a href="interface_webdriver_CommandExecutor.html">webdriver.CommandExecutor</a><li><a href="enum_webdriver_CommandName.html">webdriver.CommandName</a><li><a href="class_webdriver_EventEmitter.html">webdriver.EventEmitter</a><li><a href="class_webdriver_FileDetector.html">webdriver.FileDetector</a><li><a href="enum_webdriver_Key.html">webdriver.Key</a><li><a href="class_webdriver_Locator.html">webdriver.Locator</a><li><a href="class_webdriver_Serializable.html">webdriver.Serializable</a><li><a href="class_webdriver_Session.html">webdriver.Session</a><li><a href="class_webdriver_TouchSequence.html">webdriver.TouchSequence</a><li><a href="class_webdriver_UnhandledAlertError.html">webdriver.UnhandledAlertError</a><li><a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a><li><a href="class_webdriver_WebDriver_Logs.html">webdriver.WebDriver.Logs</a><li><a href="class_webdriver_WebDriver_Navigation.html">webdriver.WebDriver.Navigation</a><li><a href="class_webdriver_WebDriver_Options.html">webdriver.WebDriver.Options</a><li><a href="class_webdriver_WebDriver_TargetLocator.html">webdriver.WebDriver.TargetLocator</a><li><a href="class_webdriver_WebDriver_Timeouts.html">webdriver.WebDriver.Timeouts</a><li><a href="class_webdriver_WebDriver_Window.html">webdriver.WebDriver.Window</a><li><a href="class_webdriver_WebElement.html">webdriver.WebElement</a><li><a href="class_webdriver_WebElementPromise.html">webdriver.WebElementPromise</a><li><a href="namespace_webdriver_http.html">webdriver.http</a><li><a href="interface_webdriver_http_Client.html">webdriver.http.Client</a><li><a href="class_webdriver_http_Executor.html">webdriver.http.Executor</a><li><a href="class_webdriver_http_Request.html">webdriver.http.Request</a><li><a href="class_webdriver_http_Response.html">webdriver.http.Response</a><li><a href="namespace_webdriver_logging.html">webdriver.logging</a><li><a href="class_webdriver_logging_Entry.html">webdriver.logging.Entry</a><li><a href="enum_webdriver_logging_Level.html">webdriver.logging.Level</a><li><a href="class_webdriver_logging_Preferences.html">webdriver.logging.Preferences</a><li><a href="enum_webdriver_logging_Type.html">webdriver.logging.Type</a><li><a href="namespace_webdriver_promise.html">webdriver.promise</a><li><a href="class_webdriver_promise_Callback_.html">webdriver.promise.Callback_</a><li><a href="class_webdriver_promise_CancellationError.html">webdriver.promise.CancellationError</a><li><a href="class_webdriver_promise_ControlFlow.html">webdriver.promise.ControlFlow</a><li><a href="enum_webdriver_promise_ControlFlow_EventType.html">webdriver.promise.ControlFlow.EventType</a><li><a href="class_webdriver_promise_Deferred.html">webdriver.promise.Deferred</a><li><a href="class_webdriver_promise_Frame_.html">webdriver.promise.Frame_</a><li><a href="class_webdriver_promise_MicroTask_.html">webdriver.promise.MicroTask_</a><li><a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a><li><a href="enum_webdriver_promise_Promise_State_.html">webdriver.promise.Promise.State_</a><li><a href="class_webdriver_promise_Task_.html">webdriver.promise.Task_</a><li><a href="interface_webdriver_promise_Thenable.html">webdriver.promise.Thenable</a><li><a href="namespace_webdriver_stacktrace.html">webdriver.stacktrace</a><li><a href="class_webdriver_stacktrace_Frame.html">webdriver.stacktrace.Frame</a><li><a href="class_webdriver_stacktrace_Snapshot.html">webdriver.stacktrace.Snapshot</a><li><a href="namespace_webdriver_testing.html">webdriver.testing</a><li><a href="class_webdriver_testing_Assertion.html">webdriver.testing.Assertion</a><li><a href="class_webdriver_testing_Assertion_DelegatingMatcher_.html">webdriver.testing.Assertion.DelegatingMatcher_</a><li><a href="class_webdriver_testing_ContainsMatcher.html">webdriver.testing.ContainsMatcher</a><li><a href="class_webdriver_testing_NegatedAssertion.html">webdriver.testing.NegatedAssertion</a><li><a href="namespace_webdriver_testing_assert.html">webdriver.testing.assert</a><li><a href="namespace_webdriver_testing_asserts.html">webdriver.testing.asserts</a><li><a href="namespace_webdriver_until.html">webdriver.until</a><li><a href="class_webdriver_until_Condition.html">webdriver.until.Condition</a></ul></div></div><h3><a href="Changes.html">Changes</a></h3></nav></main><div class="pre-footer"><div></div></div><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>
\ No newline at end of file