selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
24 lines • 4.93 kB
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>Alert</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>Namespace:</b> <a href="namespace_webdriver.html">webdriver</a></div><div class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l2283">View Source</a></div><h1>class Alert</h1><p>Represents a modal dialog such as <code>alert</code>, <code>confirm</code>, or
<code>prompt</code>. Provides functions to retrieve the message displayed with
the alert, accept or dismiss the alert, and set the response text (in the
case of <code>prompt</code>).</p>
<h3>new Alert(<wbr>driver, text)</h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>driver<code><a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a></code><dd><p>The driver controlling the browser this
alert is attached to.</p>
<dt>text<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The message text displayed with this alert.</p>
</dl></div></div><h2>Instance Methods</h2><div id="accept" class="function"><div><h3>accept()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l2308">code »</a></span></h3><p>Accepts this alert.</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="dismiss" class="function"><div><h3>dismiss()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l2320">code »</a></span></h3><p>Dismisses this alert.</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="getText" class="function"><div><h3>getText()<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l2298">code »</a></span></h3><p>Retrieves the message text displayed with this alert. For instance, if the
alert were opened with alert("hello"), then this would return "hello".</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 to the text displayed with this alert.</p>
</dl></div></div></div></div><hr class="fn-sep"><div id="sendKeys" class="function"><div><h3>sendKeys(<wbr>text)<span class="codelink"><a href="source/lib/webdriver/webdriver.js.src.html#l2335">code »</a></span></h3><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).</p>
<div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>text<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The text to set.</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 this command has completed.</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>