You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
12 KiB
26 lines
12 KiB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>webdriver.By</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace webdriver.By</h1><a class="source" href="source/lib/webdriver/locators.js.src.html#l68">code »</a></header><section><p>A collection of factory functions for creating <code class="type"><a href="class_webdriver_Locator.html">webdriver.Locator</a></code>
|
|
instances.</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="typedefs"><h2>Type Definitions</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l96">code »</a><a class="member" name="webdriver.By.Hash">webdriver.By.Hash</a> : <code class="type">({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></div><div>Short-hand expressions for the primary element locator strategies.
|
|
For example the following two statements are equivalent:
|
|
<code><pre>
|
|
var e1 = driver.findElement(webdriver.By.id('foo'));
|
|
var e2 = driver.findElement({id: 'foo'});
|
|
</pre></code>
|
|
|
|
<p>Care should be taken when using JavaScript minifiers (such as the
|
|
Closure compiler), as locator hashes will always be parsed using
|
|
the un-obfuscated properties listed below.</div></summary></details></div></div></section><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l108">code »</a><span class="member"><a name="webdriver.By.className">webdriver.By.className</a> <span class="args">( className )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates elements that have a specific class name. The returned locator
|
|
is equivalent to searching for elements with the CSS selector ".clazz".</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>className: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The class name to search for.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l121">code »</a><span class="member"><a name="webdriver.By.css">webdriver.By.css</a> <span class="args">( selector )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates elements using a CSS selector. For browsers that do not support
|
|
CSS selectors, WebDriver implementations may return an
|
|
<code class="type"><a href="enum_bot_Error_State.html#bot.Error.State.INVALID_SELECTOR">invalid selector</a></code> error. An
|
|
implementation may, however, emulate the CSS selector API.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>selector: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The CSS selector to use.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l130">code »</a><span class="member"><a name="webdriver.By.id">webdriver.By.id</a> <span class="args">( id )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates an element by its ID.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>id: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The ID to search for.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l153">code »</a><span class="member"><a name="webdriver.By.js">webdriver.By.js</a> <span class="args">( script, var_args )</span> ⇒ <code class="type">function(!<a href="class_webdriver_WebDriver.html">webdriver.WebDriver</a>): !<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code></span></div><p>Locates an elements by evaluating a
|
|
<code class="type"><a href="class_webdriver_WebDriver.html#executeScript">JavaScript expression</a></code>.
|
|
The result of this expression must be an element or list of elements.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>script: <code class="type">!(<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/Function">Function</a>)</code><dd>The script to execute.<dt>var_args: <code class="type">...*</code><dd>The arguments to pass to the script.</dl><tr><th>Returns<tr><td><dl>A new,
|
|
JavaScript-based locator function.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l140">code »</a><span class="member"><a name="webdriver.By.linkText">webdriver.By.linkText</a> <span class="args">( text )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates link elements whose <code class="type"><a href="class_webdriver_WebElement.html#getText">visible
|
|
text</a></code> matches the given string.</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 link text to search for.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l167">code »</a><span class="member"><a name="webdriver.By.name">webdriver.By.name</a> <span class="args">( name )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates elements whose <code >name</code> attribute has the given value.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The name attribute to search for.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l177">code »</a><span class="member"><a name="webdriver.By.partialLinkText">webdriver.By.partialLinkText</a> <span class="args">( text )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates link elements whose <code class="type"><a href="class_webdriver_WebElement.html#getText">visible
|
|
text</a></code> contains the given substring.</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 substring to check for in a link's visible text.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l189">code »</a><span class="member"><a name="webdriver.By.tagName">webdriver.By.tagName</a> <span class="args">( text )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates elements with a given tag name. The returned locator is
|
|
equivalent to using the <code >getElementsByTagName</code> DOM function.</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 substring to check for in a link's visible text.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/locators.js.src.html#l204">code »</a><span class="member"><a name="webdriver.By.xpath">webdriver.By.xpath</a> <span class="args">( xpath )</span> ⇒ <code class="type">!<a href="class_webdriver_Locator.html">webdriver.Locator</a></code></span></div><p>Locates elements matching a XPath selector. Care should be taken when
|
|
using an XPath selector with a <code class="type"><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code> as WebDriver
|
|
will respect the context in the specified in the selector. For example,
|
|
given the selector <code >"//div"</code>, WebDriver will search from the
|
|
document root regardless of whether the locator was used with a
|
|
WebElement.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>xpath: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The XPath selector to use.</dl><tr><th>Returns<tr><td><dl>The new locator.</dl></table></div></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>No data</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>No data</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>No data</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> |