UNPKG

selenium-webdriver

Version:

The official WebDriver JavaScript bindings from the Selenium project

49 lines 10.7 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>TouchSequence</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/touchsequence.js.src.html#l41">View Source</a></div><h1>class TouchSequence</h1><p>Class for defining sequences of user touch interactions. Each sequence will not be executed until <a href="class_webdriver_TouchSequence.html#perform"><code>#perform</code></a> is called.</p> <p>Example:</p> <pre><code>new webdriver.TouchSequence(driver). tapAndHold({x: 0, y: 0}). move({x: 3, y: 4}). release({x: 10, y: 10}). perform(); </code></pre> <h3>new TouchSequence(<wbr>driver)</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 instance to use.</p> </dl></div></div><h2>Instance Methods</h2><div id="doubleTap" class="function"><div><h3>doubleTap(<wbr>elem)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l106">code »</a></span></h3><p>Double taps an element.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>elem<code><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code><dd><p>The element to double tap.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="flick" class="function"><div><h3>flick(<wbr>speed)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l220">code »</a></span></h3><p>Flick, starting anywhere on the screen, at speed xspeed and yspeed.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>speed<code>{xspeed: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, yspeed: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code><dd><p>The speed to flick in each direction, in pixels per second.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="flickElement" class="function"><div><h3>flickElement(<wbr>elem, offset, speed)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l238">code »</a></span></h3><p>Flick starting at elem and moving by x and y at specified speed.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>elem<code><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code><dd><p>The element where flick starts.</p> <dt>offset<code>{x: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, y: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code><dd><p>The offset to flick to.</p> <dt>speed<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd><p>The speed to flick at in pixels per second.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="longPress" class="function"><div><h3>longPress(<wbr>elem)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l121">code »</a></span></h3><p>Long press on an element.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>elem<code><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code><dd><p>The element to long press.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="move" class="function"><div><h3>move(<wbr>location)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l152">code »</a></span></h3><p>Move a held <a href="class_webdriver_TouchSequence.html#tapAndHold">touch</a> to the specified location.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>location<code>{x: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, y: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code><dd><p>The location to move to.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="perform" class="function"><div><h3>perform()<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l71">code »</a></span></h3><p>Executes this action sequence.</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></code><dd><p>A promise that will be resolved once this sequence has completed.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="release" class="function"><div><h3>release(<wbr>location)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l168">code »</a></span></h3><p>Release a held <a href="class_webdriver_TouchSequence.html#tapAndHold">touch</a> at the specified location.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>location<code>{x: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, y: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code><dd><p>The location to release at.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="scroll" class="function"><div><h3>scroll(<wbr>offset)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l184">code »</a></span></h3><p>Scrolls the touch screen by the given offset.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>offset<code>{x: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, y: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code><dd><p>The offset to scroll to.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="scrollFromElement" class="function"><div><h3>scrollFromElement(<wbr>elem, offset)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l202">code »</a></span></h3><p>Scrolls the touch screen, starting on <code>elem</code> and moving by the specified offset.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>elem<code><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code><dd><p>The element where scroll starts.</p> <dt>offset<code>{x: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, y: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code><dd><p>The offset to scroll to.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="tap" class="function"><div><h3>tap(<wbr>elem)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l91">code »</a></span></h3><p>Taps an element.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>elem<code><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code><dd><p>The element to tap.</p> </dl></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 self reference.</p> </dl></div></div></div></div><hr class="fn-sep"><div id="tapAndHold" class="function"><div><h3>tapAndHold(<wbr>location)<span class="codelink"><a href="source/lib/webdriver/touchsequence.js.src.html#l136">code »</a></span></h3><p>Touch down at the given location.</p> <div><div class="fn-details"><div><b>Parameters</b></div><dl><dt>location<code>{x: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, y: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>}</code><dd><p>The location to touch down at.</p> </dl></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 self reference.</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>