UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

60 lines 15.1 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>Capabilities</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.html">selenium-webdriver</a></div><div class="codelink"><a href="source/index.js.src.html#l46">View Source</a></div><h1>class Capabilities</h1><pre class="inheritance"><a href="class_webdriver_Serializable.html">webdriver.Serializable</a>&lt;<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>, ?&gt;&gt; &#x2514; Capabilities</pre><dl><dt>Alias for <code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code></dl><h3>new Capabilities(<wbr>opt_other)</h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>opt_other<code>?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd><p>Another set of capabilities to merge into this instance.</p> </dl></div></div><h2>Instance Methods</h2><div id="get" class="function"><div><h3>get(<wbr>key)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l340">code »</a></span></h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>key<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The capability to return.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><p>The capability with the given key, or <code>null</code> if it has not been set.</p> </div></div></div></div><hr class="fn-sep"><div id="has" class="function"><div><h3>has(<wbr>key)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l353">code »</a></span></h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>key<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The capability to check.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd><p>Whether the specified capability is set.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="merge" class="function"><div><h3>merge(<wbr>other)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l307">code »</a></span></h3><p>Merges another set of capabilities into this instance. Any duplicates in the provided set will override those already set on this instance.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>other<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd><p>The capabilities to merge into this instance.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="serialize" class="function"><div><h3>serialize()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l295">code »</a></span></h3><p>Returns either this instance&#39;s serialized represention, if immediately available, or a promise for its serialized representation. This function is conceptually equivalent to objects that have a <code>toJSON()</code> property, except the serialize() result may be a promise or an object containing a promise (which are not directly JSON friendly).</p> <p><b>Overrides: </b><a href="class_webdriver_Serializable.html#serialize">webdriver.Serializable</a></p><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><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>, ?&gt;</code><dd><p>The JSON representation of this instance. Note, the returned object may contain nested promises that are promised values.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="set" class="function"><div><h3>set(<wbr>key, value)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l325">code »</a></span></h3><div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>key<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The capability to set.</p> <dt>value<code>*</code><dd><p>The capability value. Capability values must be JSON serializable. Pass <code>null</code> to unset the capability.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setAlertBehavior" class="function"><div><h3>setAlertBehavior(<wbr>behavior)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l409">code »</a></span></h3><p>Sets the default action to take with an unexpected alert before returning an error.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>behavior<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd><p>The desired behavior; should be &#34;accept&#34;, &#34;dismiss&#34;, or &#34;ignore&#34;. Defaults to &#34;dismiss&#34;.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setEnableNativeEvents" class="function"><div><h3>setEnableNativeEvents(<wbr>enabled)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l386">code »</a></span></h3><p>Sets whether native events should be used.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>enabled<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code><dd><p>Whether to enable native events.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setLoggingPrefs" class="function"><div><h3>setLoggingPrefs(<wbr>prefs)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l366">code »</a></span></h3><p>Sets the logging preferences. Preferences may be specified as a <a href="class_webdriver_logging_Preferences.html"><code>webdriver.logging.Preferences</code></a> instance, or a as a map of log-type to log-level.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>prefs<code>(<a href="class_webdriver_logging_Preferences.html">webdriver.logging.Preferences</a>|<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 logging preferences.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setProxy" class="function"><div><h3>setProxy(<wbr>proxy)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l376">code »</a></span></h3><p>Sets the proxy configuration for this instance.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>proxy<code>{proxyType: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>}</code><dd><p>The desired proxy configuration.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="setScrollBehavior" class="function"><div><h3>setScrollBehavior(<wbr>behavior)<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l397">code »</a></span></h3><p>Sets how elements should be scrolled into view for interaction.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>behavior<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd><p>The desired scroll behavior: either 0 to align with the top of the viewport or 1 to align with the bottom.</p> </dl></div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A self reference.</p> </dl></div></div></div></div><h2>Static Functions</h2><div id="Capabilities.android" class="function"><div><h3>Capabilities.android()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l186">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for Android.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.chrome" class="function"><div><h3>Capabilities.chrome()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l196">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for Chrome.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.firefox" class="function"><div><h3>Capabilities.firefox()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l205">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for Firefox.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.htmlunit" class="function"><div><h3>Capabilities.htmlunit()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l273">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for HTMLUnit.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.htmlunitwithjs" class="function"><div><h3>Capabilities.htmlunitwithjs()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l283">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for HTMLUnit with enabled Javascript.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.ie" class="function"><div><h3>Capabilities.ie()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l215">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for Internet Explorer.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.ipad" class="function"><div><h3>Capabilities.ipad()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l226">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for iPad.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.iphone" class="function"><div><h3>Capabilities.iphone()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l236">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for iPhone.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.opera" class="function"><div><h3>Capabilities.opera()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l246">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for Opera.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.phantomjs" class="function"><div><h3>Capabilities.phantomjs()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l255">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for PhantomJS.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="Capabilities.safari" class="function"><div><h3>Capabilities.safari()<span class="codelink"><a href="source/lib/webdriver/capabilities.js.src.html#l264">code »</a></span></h3><div><div class="fn-details"><div><b>Returns</b></div><dl><dt><code><a href="class_webdriver_Capabilities.html">webdriver.Capabilities</a></code><dd><p>A basic set of capabilities for Safari.</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>