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.
87 lines
22 KiB
87 lines
22 KiB
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>webdriver.ActionSequence</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.ActionSequence</h1><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l43">code »</a></header><section><p>Class for defining sequences of complex user interactions. Each sequence
|
|
will not be executed until <code class="type"><a class="unresolved-link">#perform</a></code> is called.
|
|
|
|
<p>Example:<pre><code>
|
|
new webdriver.ActionSequence(driver).
|
|
keyDown(webdriver.Key.SHIFT).
|
|
click(element1).
|
|
click(element2).
|
|
dragAndDrop(element3, element4).
|
|
keyUp(webdriver.Key.SHIFT).
|
|
perform();
|
|
</pre></code><h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">webdriver.ActionSequence <span class="args">( driver )</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 instance to use.</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><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l250">code »</a><span class="member"><a name="click">click</a> <span class="args">( opt_elementOrButton, opt_button )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Clicks a mouse button.
|
|
|
|
<p>If an element is provided, the mouse will first be moved to the center
|
|
of that element. This is equivalent to:
|
|
<pre><code>sequence.mouseMove(element).click()</code></pre></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_elementOrButton: <code class="type">(<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>|<a href="enum_webdriver_Button.html">webdriver.Button</a>)=</code><dd>Either
|
|
the element to interact with or the button to click with.
|
|
Defaults to <code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code> if neither an element nor
|
|
button is specified.<dt>opt_button: <code class="type"><a href="enum_webdriver_Button.html">webdriver.Button</a>=</code><dd>The button to use. Defaults to
|
|
<code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code>. Ignored if a button is provided as the
|
|
first argument.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l276">code »</a><span class="member"><a name="doubleClick">doubleClick</a> <span class="args">( opt_elementOrButton, opt_button )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Double-clicks a mouse button.
|
|
|
|
<p>If an element is provided, the mouse will first be moved to the center of
|
|
that element. This is equivalent to:
|
|
<pre><code>sequence.mouseMove(element).doubleClick()</code></pre>
|
|
|
|
<p>Warning: this method currently only supports the left mouse button. See
|
|
http://code.google.com/p/selenium/issues/detail?id=4047</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_elementOrButton: <code class="type">(<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>|<a href="enum_webdriver_Button.html">webdriver.Button</a>)=</code><dd>Either
|
|
the element to interact with or the button to click with.
|
|
Defaults to <code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code> if neither an element nor
|
|
button is specified.<dt>opt_button: <code class="type"><a href="enum_webdriver_Button.html">webdriver.Button</a>=</code><dd>The button to use. Defaults to
|
|
<code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code>. Ignored if a button is provided as the
|
|
first argument.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l229">code »</a><span class="member"><a name="dragAndDrop">dragAndDrop</a> <span class="args">( element, location )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Convenience function for performing a "drag and drop" manuever. The target
|
|
element may be moved to the location of another element, or by an offset (in
|
|
pixels).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type">!<a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code><dd>The element to drag.<dt>location: <code class="type">(!<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>|{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>The
|
|
location to drag to, either as another WebElement or an offset in pixels.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l324">code »</a><span class="member"><a name="keyDown">keyDown</a> <span class="args">( key )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Performs a modifier key press. The modifier key is <em>not released</em>
|
|
until <code class="type"><a class="unresolved-link">#keyUp</a></code> or <code class="type"><a class="unresolved-link">#sendKeys</a></code> is called. The key press will be
|
|
targetted at the currently focused element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>key: <code class="type">!<a href="enum_webdriver_Key.html">webdriver.Key</a></code><dd>The modifier key to push. Must be one of
|
|
{ALT, CONTROL, SHIFT, COMMAND, META}.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>If the key is not a valid modifier key.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l338">code »</a><span class="member"><a name="keyUp">keyUp</a> <span class="args">( key )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Performs a modifier key release. The release is targetted at the currently
|
|
focused element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>key: <code class="type">!<a href="enum_webdriver_Key.html">webdriver.Key</a></code><dd>The modifier key to release. Must be one of
|
|
{ALT, CONTROL, SHIFT, COMMAND, META}.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>If the key is not a valid modifier key.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l186">code »</a><span class="member"><a name="mouseDown">mouseDown</a> <span class="args">( opt_elementOrButton, opt_button )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Presses a mouse button. The mouse button will not be released until
|
|
<code class="type"><a class="unresolved-link">#mouseUp</a></code> is called, regardless of whether that call is made in this
|
|
sequence or another. The behavior for out-of-order events (e.g. mouseDown,
|
|
click) is undefined.
|
|
|
|
<p>If an element is provided, the mouse will first be moved to the center
|
|
of that element. This is equivalent to:
|
|
<pre><code>sequence.mouseMove(element).mouseDown()</code></pre>
|
|
|
|
<p>Warning: this method currently only supports the left mouse button. See
|
|
http://code.google.com/p/selenium/issues/detail?id=4047</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_elementOrButton: <code class="type">(<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>|<a href="enum_webdriver_Button.html">webdriver.Button</a>)=</code><dd>Either
|
|
the element to interact with or the button to click with.
|
|
Defaults to <code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code> if neither an element nor
|
|
button is specified.<dt>opt_button: <code class="type"><a href="enum_webdriver_Button.html">webdriver.Button</a>=</code><dd>The button to use. Defaults to
|
|
<code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code>. Ignored if a button is provided as the
|
|
first argument.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l100">code »</a><span class="member"><a name="mouseMove">mouseMove</a> <span class="args">( location, opt_offset )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Moves the mouse. The location to move to may be specified in terms of the
|
|
mouse's current location, an offset relative to the top-left corner of an
|
|
element, or an element (in which case the middle of the element is used).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>location: <code class="type">(!<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>|{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>The
|
|
location to drag to, as either another WebElement or an offset in pixels.<dt>opt_offset: <code class="type">{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>If the target <code >location</code>
|
|
is defined as a <code class="type"><a href="class_webdriver_WebElement.html">webdriver.WebElement</a></code>, this parameter defines an
|
|
offset within that element. The offset should be specified in pixels
|
|
relative to the top-left corner of the element's bounding box. If
|
|
omitted, the element's center will be used as the target offset.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l213">code »</a><span class="member"><a name="mouseUp">mouseUp</a> <span class="args">( opt_elementOrButton, opt_button )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Releases a mouse button. Behavior is undefined for calling this function
|
|
without a previous call to <code class="type"><a class="unresolved-link">#mouseDown</a></code>.
|
|
|
|
<p>If an element is provided, the mouse will first be moved to the center
|
|
of that element. This is equivalent to:
|
|
<pre><code>sequence.mouseMove(element).mouseUp()</code></pre>
|
|
|
|
<p>Warning: this method currently only supports the left mouse button. See
|
|
http://code.google.com/p/selenium/issues/detail?id=4047</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_elementOrButton: <code class="type">(<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>|<a href="enum_webdriver_Button.html">webdriver.Button</a>)=</code><dd>Either
|
|
the element to interact with or the button to click with.
|
|
Defaults to <code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code> if neither an element nor
|
|
button is specified.<dt>opt_button: <code class="type"><a href="enum_webdriver_Button.html">webdriver.Button</a>=</code><dd>The button to use. Defaults to
|
|
<code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code>. Ignored if a button is provided as the
|
|
first argument.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l73">code »</a><span class="member"><a name="perform">perform</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_webdriver_promise_Promise.html">webdriver.promise.Promise</a></code></span></div><p>Executes this action sequence.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A promise that will be resolved once
|
|
this sequence has completed.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l291">code »</a><span class="member"><a name="scheduleKeyboardAction_">scheduleKeyboardAction_</a> <span class="args">( description, keys )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Schedules a keyboard action.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>description: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A simple descriptive label for the scheduled
|
|
action.<dt>keys: <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></code><dd>The keys to send.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l144">code »</a><span class="member"><a name="scheduleMouseAction_">scheduleMouseAction_</a> <span class="args">( description, commandName, opt_elementOrButton, opt_button )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Schedules a mouse action.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>description: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A simple descriptive label for the scheduled
|
|
action.<dt>commandName: <code class="type">!<a href="enum_webdriver_CommandName.html">webdriver.CommandName</a></code><dd>The name of the command.<dt>opt_elementOrButton: <code class="type">(<a href="class_webdriver_WebElement.html">webdriver.WebElement</a>|<a href="enum_webdriver_Button.html">webdriver.Button</a>)=</code><dd>Either
|
|
the element to interact with or the button to click with.
|
|
Defaults to <code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code> if neither an element nor
|
|
button is specified.<dt>opt_button: <code class="type"><a href="enum_webdriver_Button.html">webdriver.Button</a>=</code><dd>The button to use. Defaults to
|
|
<code class="type"><a href="enum_webdriver_Button.html#webdriver.Button.LEFT">webdriver.Button.LEFT</a></code>. Ignored if the previous argument is
|
|
provided as a button.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l60">code »</a><span class="member"><a name="schedule_">schedule_</a> <span class="args">( description, command )</span></span></div><p>Schedules an action to be executed each time <code class="type"><a class="unresolved-link">#perform</a></code> is called on
|
|
this instance.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>description: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>A description of the command.<dt>command: <code class="type">!<a href="class_webdriver_Command.html">webdriver.Command</a></code><dd>The command.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l353">code »</a><span class="member"><a name="sendKeys">sendKeys</a> <span class="args">( var_args )</span> ⇒ <code class="type">!<a href="class_webdriver_ActionSequence.html">webdriver.ActionSequence</a></code></span></div><p>Simulates typing multiple keys. Each modifier key encountered in the
|
|
sequence will not be released until it is encountered again. All key events
|
|
will be targetted at the currently focused element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>|!<a href="enum_webdriver_Key.html">webdriver.Key</a>|!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>)</code><dd>The keys to type.</dl><tr><th>Returns<tr><td><dl>A self reference.</dl><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>If the key is not a valid modifier key.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l49">code »</a><span class="member"><a name="actions_">actions_</a> : <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></code></span></div></summary></details></div></div><div class="wrap-details private"><div><details><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l46">code »</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></section><section id="static-functions"><h2>Static Functions</h2><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/webdriver/actionsequence.js.src.html#l307">code »</a><span class="member"><a name="webdriver.ActionSequence.checkModifierKey_">webdriver.ActionSequence.checkModifierKey_</a> <span class="args">( key )</span></span></div><p>Checks that a key is a modifier key.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>key: <code class="type">!<a href="enum_webdriver_Key.html">webdriver.Key</a></code><dd>The key to check.</dl><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>If the key is not a modifier key.</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> |