UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

20 lines 9.37 kB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>webdriver.AlertPromise</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class webdriver.AlertPromise</h1><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2187">code &raquo;</a><pre><code><a href="class_webdriver_Alert.html">webdriver.Alert</a> &#x2514; webdriver.AlertPromise</code></pre><dl><dt>All implemented interfaces:<dd><code><a href="">webdriver.promise.Thenable.&lt;webdriver.Alert&gt;</a></code></dl></header><section><p>AlertPromise is a promise that will be fulfilled with an Alert. This promise serves as a forward proxy on an Alert, allowing calls to be scheduled directly on this instance before the underlying Alert has been fulfilled. In other words, the following two statements are equivalent: <pre><code> driver.switchTo().alert().dismiss(); driver.switchTo().alert().then(function(alert) { return alert.dismiss(); }); </code></pre><h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">webdriver.AlertPromise <span class="args">( driver, alert )</span></span></div><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>driver: <code class="type">!<a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a></code><dd>The driver controlling the browser this alert is attached to.<dt>alert: <code class="type">!<a href="interface_webdriver_promise_Thenable.html">webdriver.promise.Thenable</a></code><dd>A thenable that will be fulfilled with the promised alert.</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><h3>Defined in <code class="type">webdriver.AlertPromise</code></h3><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2191">code &raquo;</a><span class="member"><a name="cancel">cancel</a> <span class="args">( )</span></span></div></summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2194">code &raquo;</a><span class="member"><a name="isPending">isPending</a> <span class="args">( )</span> &rArr; <code class="type">boolean</code></span></div></summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2197">code &raquo;</a><span class="member"><a name="then">then</a> <span class="args">( )</span> &rArr; <code class="type">webdriver.promise.Promise</code></span></div></summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2200">code &raquo;</a><span class="member"><a name="thenCatch">thenCatch</a> <span class="args">( )</span> &rArr; <code class="type">webdriver.promise.Promise</code></span></div></summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2203">code &raquo;</a><span class="member"><a name="thenFinally">thenFinally</a> <span class="args">( )</span> &rArr; <code class="type">webdriver.promise.Promise</code></span></div></summary></details></div></div><h3>Defined in <code class="type"><a href="class_webdriver_Alert.html">webdriver.Alert</a></code></h3><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2130">code &raquo;</a><span class="member"><a name="accept">accept</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>.&lt;void&gt;</code></span></div><p>Accepts this alert.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A promise that will be resolved when this command has completed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2142">code &raquo;</a><span class="member"><a name="dismiss">dismiss</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>.&lt;void&gt;</code></span></div><p>Dismisses this alert.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A promise that will be resolved when this command has completed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2120">code &raquo;</a><span class="member"><a name="getText">getText</a> <span class="args">( )</span> &rArr; <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>.&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>&gt;</code></span></div><p>Retrieves the message text displayed with this alert. For instance, if the alert were opened with alert("hello"), then this would return "hello".</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A promise that will be resolved to the text displayed with this alert.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2157">code &raquo;</a><span class="member"><a name="sendKeys">sendKeys</a> <span class="args">( text )</span> &rArr; <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>.&lt;void&gt;</code></span></div><p>Sets the response text on this alert. This command will return an error if the underlying alert does not support response text (e.g. window.alert and window.confirm).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>text: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The text to set.</dl><tr><th>Returns<tr><td><dl>A promise that will be resolved when this command has completed.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><h3>Defined in <code class="type"><a href="class_webdriver_Alert.html">webdriver.Alert</a></code></h3><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2107">code &raquo;</a><span class="member"><a name="driver_">driver_</a> : <code class="type">!<a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a></code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/webdriver/webdriver.js.src.html#l2110">code &raquo;</a><span class="member"><a name="text_">text_</a> : <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a>.&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>&gt;</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/lib/webdriver/webdriver.js.src.html#l2187">code &raquo;</a><span class="member"><a name="webdriver.AlertPromise.superClass_">webdriver.AlertPromise.superClass_</a> : <code class="type"><a href="class_webdriver_Alert.html">webdriver.Alert.prototype</a></code></span></div></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>