public class SwipeAction extends EventAction implements ScrollAction
Constructor and Description |
---|
SwipeAction(Direction.PhysicalDirection direction,
int steps)
Defaults timeoutMillis to 1000 and no drag.
|
SwipeAction(Direction.PhysicalDirection direction,
int steps,
boolean drag,
long timeoutMillis)
Defaults all margin ratios to 0.1F.
|
SwipeAction(Direction.PhysicalDirection direction,
int steps,
boolean drag,
long timeoutMillis,
float topMarginRatio,
float leftMarginRatio,
float bottomMarginRatio,
float rightMarginRatio) |
Modifier and Type | Method and Description |
---|---|
static int |
getFlingSteps()
Returns the
flingSteps used in toFling(io.appium.droiddriver.scroll.Direction.PhysicalDirection) . |
static int |
getScrollSteps()
Returns the
scrollSteps used in toScroll(io.appium.droiddriver.scroll.Direction.PhysicalDirection) . |
boolean |
perform(InputInjector injector,
UiElement element)
Performs the action by injecting synthesized events.
|
static void |
setFlingSteps(int flingSteps)
Sets the
flingSteps used in toFling(io.appium.droiddriver.scroll.Direction.PhysicalDirection) . |
static void |
setScrollSteps(int scrollSteps)
|
static SwipeAction |
toFling(Direction.PhysicalDirection direction)
Gets
SwipeAction instances for flinging. |
static SwipeAction |
toScroll(Direction.PhysicalDirection direction)
Gets
SwipeAction instances for scrolling. |
java.lang.String |
toString() |
perform
getTimeoutMillis
public SwipeAction(Direction.PhysicalDirection direction, int steps)
public SwipeAction(Direction.PhysicalDirection direction, int steps, boolean drag, long timeoutMillis)
public SwipeAction(Direction.PhysicalDirection direction, int steps, boolean drag, long timeoutMillis, float topMarginRatio, float leftMarginRatio, float bottomMarginRatio, float rightMarginRatio)
direction
- the scroll direction specifying where the view port will
move, instead of the finger.steps
- minimum 2; (steps-1) is the number of ACTION_MOVE
that
will be injected between ACTION_DOWN
and ACTION_UP
.drag
- whether this is a dragtimeoutMillis
- the value returned by BaseAction.getTimeoutMillis()
topMarginRatio
- margin ratio from topleftMarginRatio
- margin ratio from leftbottomMarginRatio
- margin ratio from bottomrightMarginRatio
- margin ratio from rightpublic static int getScrollSteps()
scrollSteps
used in toScroll(io.appium.droiddriver.scroll.Direction.PhysicalDirection)
.public static void setScrollSteps(int scrollSteps)
public static int getFlingSteps()
flingSteps
used in toFling(io.appium.droiddriver.scroll.Direction.PhysicalDirection)
.public static void setFlingSteps(int flingSteps)
flingSteps
used in toFling(io.appium.droiddriver.scroll.Direction.PhysicalDirection)
.public static SwipeAction toScroll(Direction.PhysicalDirection direction)
SwipeAction
instances for scrolling.
Note: This may result in flinging instead of scrolling, depending on the
size of the target UiElement and the SDK version of the device. If it does
not behave as expected, you can change steps with setScrollSteps(int)
.
direction
- specifies where the view port will move, instead of the
finger.ViewConfiguration.getScaledMinimumFlingVelocity()
public static SwipeAction toFling(Direction.PhysicalDirection direction)
SwipeAction
instances for flinging.
Note: This may not actually fling, depending on the size of the target
UiElement and the SDK version of the device. If it does not behave as
expected, you can change steps with setFlingSteps(int)
.
direction
- specifies where the view port will move, instead of the
finger.ViewConfiguration.getScaledMinimumFlingVelocity()
public boolean perform(InputInjector injector, UiElement element)
EventAction
perform
in class EventAction
injector
- the injector to inject InputEvent
selement
- the UiElement to perform the action on