Class Index | File Index

Classes


Class webdriver.ActionSequence


Defined in: actionsequence.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Class for defining sequences of complex user interactions.
Method Summary
Method Attributes Method Name and Description
 
click(opt_elementOrButton, opt_button)
Clicks a mouse button.
 
doubleClick(opt_elementOrButton, opt_button)
Double-clicks a mouse button.
 
dragAndDrop(element, location)
Convenience function for performing a "drag and drop" manuever.
 
keyDown(key)
Performs a modifier key press.
 
keyUp(key)
Performs a modifier key release.
 
mouseDown(opt_elementOrButton, opt_button)
Presses a mouse button.
 
mouseMove(location, opt_offset)
Moves the mouse.
 
mouseUp(opt_elementOrButton, opt_button)
Releases a mouse button.
 
Executes this action sequence.
 
sendKeys(var_args)
Simulates typing multiple keys.
Class Detail
webdriver.ActionSequence(driver)
Class for defining sequences of complex user interactions. Each sequence will not be executed until #perform is called.

Example:


  new webdriver.ActionSequence(driver).
      keyDown(webdriver.Key.SHIFT).
      click(element1).
      click(element2).
      dragAndDrop(element3, element4).
      keyUp(webdriver.Key.SHIFT).
      perform();
Parameters:
{!webdriver.WebDriver} driver
The driver instance to use.
Method Detail
{!webdriver.ActionSequence} click(opt_elementOrButton, opt_button)
Clicks a mouse button.

If an element is provided, the mouse will first be moved to the center of that element. This is equivalent to:

sequence.mouseMove(element).click()
Parameters:
{(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton
Either the element to interact with or the button to click with. Defaults to webdriver.Button.LEFT if neither an element nor button is specified.
{webdriver.Button=} opt_button
The button to use. Defaults to webdriver.Button.LEFT. Ignored if a button is provided as the first argument.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.ActionSequence} doubleClick(opt_elementOrButton, opt_button)
Double-clicks a mouse button.

If an element is provided, the mouse will first be moved to the center of that element. This is equivalent to:

sequence.mouseMove(element).doubleClick()

Warning: this method currently only supports the left mouse button. See http://code.google.com/p/selenium/issues/detail?id=4047

Parameters:
{(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton
Either the element to interact with or the button to click with. Defaults to webdriver.Button.LEFT if neither an element nor button is specified.
{webdriver.Button=} opt_button
The button to use. Defaults to webdriver.Button.LEFT. Ignored if a button is provided as the first argument.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.ActionSequence} dragAndDrop(element, location)
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).
Parameters:
{!webdriver.WebElement} element
The element to drag.
{(!webdriver.WebElement|{x: number|y: number})} location
The location to drag to, either as another WebElement or an offset in pixels.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.ActionSequence} keyDown(key)
Performs a modifier key press. The modifier key is not released until #keyUp or #sendKeys is called. The key press will be targetted at the currently focused element.
Parameters:
{!webdriver.Key} key
The modifier key to push. Must be one of {ALT, CONTROL, SHIFT, COMMAND, META}.
Throws:
{Error}
If the key is not a valid modifier key.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.ActionSequence} keyUp(key)
Performs a modifier key release. The release is targetted at the currently focused element.
Parameters:
{!webdriver.Key} key
The modifier key to release. Must be one of {ALT, CONTROL, SHIFT, COMMAND, META}.
Throws:
{Error}
If the key is not a valid modifier key.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.ActionSequence} mouseDown(opt_elementOrButton, opt_button)
Presses a mouse button. The mouse button will not be released until #mouseUp 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.

If an element is provided, the mouse will first be moved to the center of that element. This is equivalent to:

sequence.mouseMove(element).mouseDown()

Warning: this method currently only supports the left mouse button. See http://code.google.com/p/selenium/issues/detail?id=4047

Parameters:
{(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton
Either the element to interact with or the button to click with. Defaults to webdriver.Button.LEFT if neither an element nor button is specified.
{webdriver.Button=} opt_button
The button to use. Defaults to webdriver.Button.LEFT. Ignored if a button is provided as the first argument.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.ActionSequence} mouseMove(location, opt_offset)
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).
Parameters:
{(!webdriver.WebElement|{x: number|y: number})} location
The location to drag to, as either another WebElement or an offset in pixels.
{{x: number|y: number}=} opt_offset
If the target {@code location} is defined as a webdriver.WebElement, 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.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.ActionSequence} mouseUp(opt_elementOrButton, opt_button)
Releases a mouse button. Behavior is undefined for calling this function without a previous call to #mouseDown.

If an element is provided, the mouse will first be moved to the center of that element. This is equivalent to:

sequence.mouseMove(element).mouseUp()

Warning: this method currently only supports the left mouse button. See http://code.google.com/p/selenium/issues/detail?id=4047

Parameters:
{(webdriver.WebElement|webdriver.Button)=} opt_elementOrButton
Either the element to interact with or the button to click with. Defaults to webdriver.Button.LEFT if neither an element nor button is specified.
{webdriver.Button=} opt_button
The button to use. Defaults to webdriver.Button.LEFT. Ignored if a button is provided as the first argument.
Returns:
{!webdriver.ActionSequence} A self reference.

{!webdriver.promise.Promise} perform()
Executes this action sequence.
Returns:
{!webdriver.promise.Promise} A promise that will be resolved once this sequence has completed.

{!webdriver.ActionSequence} sendKeys(var_args)
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.
Parameters:
{...(string|!webdriver.Key|!Array.<(string|!webdriver.Key)>)} var_args
The keys to type.
Throws:
{Error}
If the key is not a valid modifier key.
Returns:
{!webdriver.ActionSequence} A self reference.

Documentation generated by JsDoc Toolkit 2.4.0 on Sat Jan 25 2014 14:42:01 GMT-0500 (EST)