Class webdriver.ActionSequence
Defined in: actionsequence.js.
Constructor Attributes | Constructor Name and Description |
---|---|
webdriver.ActionSequence(driver)
Class for defining sequences of complex user interactions.
|
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.
|
|
perform()
Executes this action sequence.
|
|
sendKeys(var_args)
Simulates typing multiple keys.
|
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.
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.
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.
- 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.
- 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.
- 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.
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.
- 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.
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.
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved once this sequence has completed.
- 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.