public class TouchAction extends java.lang.Object implements PerformsActions<TouchAction>
Modifier and Type | Class and Description |
---|---|
protected class |
TouchAction.ActionParameter
Just holds values to eventually return the parameters required for the mjsonwp.
|
Modifier and Type | Field and Description |
---|---|
protected com.google.common.collect.ImmutableList.Builder<TouchAction.ActionParameter> |
parameterBuilder |
Constructor and Description |
---|
TouchAction(PerformsTouchActions performsTouchActions) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel this action, if it was partially completed by the performsTouchActions.
|
protected TouchAction |
clearParameters()
Clears all the existing action parameters and resets the instance to the initial state.
|
protected com.google.common.collect.ImmutableMap<java.lang.String,com.google.common.collect.ImmutableList<java.lang.Object>> |
getParameters()
Get the mjsonwp parameters for this Action.
|
TouchAction |
longPress(int x,
int y)
Press and hold the at an absolute position on the screen
until the contextmenu event has fired.
|
TouchAction |
longPress(int x,
int y,
java.time.Duration duration)
Press and hold the at an absolute position on the screen until the
contextmenu event has fired.
|
TouchAction |
longPress(WebElement el)
Press and hold the at the center of an element until the contextmenu event has fired.
|
TouchAction |
longPress(WebElement el,
java.time.Duration duration)
Press and hold the at the center of an element until the contextmenu event has fired.
|
TouchAction |
longPress(WebElement el,
int x,
int y)
Press and hold the at an elements upper-left corner, offset by the given amount,
until the contextmenu event has fired.
|
TouchAction |
longPress(WebElement el,
int x,
int y,
java.time.Duration duration)
Press and hold the at an elements upper-left corner, offset by the
given amount, until the contextmenu event has fired.
|
TouchAction |
moveTo(int x,
int y)
Move current touch to a new position relative to the current position on
the screen.
|
TouchAction |
moveTo(WebElement el)
Move current touch to center of an element.
|
TouchAction |
moveTo(WebElement el,
int x,
int y)
Move current touch to an element, offset from upper left corner.
|
TouchAction |
perform()
Perform this chain of actions on the performsTouchActions.
|
TouchAction |
press(int x,
int y)
Press on an absolute position on the screen.
|
TouchAction |
press(WebElement el)
Press on the center of an element.
|
TouchAction |
press(WebElement el,
int x,
int y)
Press on an element, offset from upper left corner by a number of pixels.
|
TouchAction |
release()
Remove the current touching implement from the screen (withdraw your touch).
|
TouchAction |
tap(int x,
int y)
Tap an absolute position on the screen.
|
TouchAction |
tap(WebElement el)
Tap the center of an element.
|
TouchAction |
tap(WebElement el,
int x,
int y)
Tap an element, offset from upper left corner.
|
TouchAction |
waitAction()
A wait action, used as a NOP in multi-chaining.
|
TouchAction |
waitAction(java.time.Duration duration)
Waits for specified amount of time to pass before continue to next touch action.
|
protected com.google.common.collect.ImmutableList.Builder<TouchAction.ActionParameter> parameterBuilder
public TouchAction(PerformsTouchActions performsTouchActions)
public TouchAction press(WebElement el)
el
- element to press on.public TouchAction press(int x, int y)
x
- x coordinate.y
- y coordinate.public TouchAction press(WebElement el, int x, int y)
el
- element to press on.x
- x offset.y
- y offset.public TouchAction release()
public TouchAction moveTo(WebElement el)
el
- element to move to.public TouchAction moveTo(int x, int y)
x
- change in x coordinate to move through.y
- change in y coordinate to move through.public TouchAction moveTo(WebElement el, int x, int y)
el
- element to move current touch to.x
- x offset.y
- y offset.public TouchAction tap(WebElement el)
el
- element to tap.public TouchAction tap(int x, int y)
x
- x coordinate.y
- y coordinate.public TouchAction tap(WebElement el, int x, int y)
el
- element to tap.x
- x offset.y
- y offset.public TouchAction waitAction()
public TouchAction waitAction(java.time.Duration duration)
duration
- of the wait action. Minimum time reolution unit is one millisecond.public TouchAction longPress(WebElement el)
el
- element to long-press.public TouchAction longPress(WebElement el, java.time.Duration duration)
el
- element to long-press.duration
- of the long-press. Minimum time resolution unit is one millisecond.public TouchAction longPress(int x, int y)
x
- x coordinate.y
- y coordinate.public TouchAction longPress(int x, int y, java.time.Duration duration)
x
- x coordinate.y
- y coordinate.duration
- of the long-press. Minimum time resolution unit is one millisecond.public TouchAction longPress(WebElement el, int x, int y)
el
- element to long-press.x
- x offset.y
- y offset.public TouchAction longPress(WebElement el, int x, int y, java.time.Duration duration)
el
- element to long-press.x
- x offset.y
- y offset.duration
- of the long-press. Minimum time resolution unit is one millisecond.public void cancel()
public TouchAction perform()
perform
in interface PerformsActions<TouchAction>
protected com.google.common.collect.ImmutableMap<java.lang.String,com.google.common.collect.ImmutableList<java.lang.Object>> getParameters()
protected TouchAction clearParameters()