public abstract class SentinelStrategy extends java.lang.Object implements ScrollStepStrategy
ScrollStepStrategy
that determines whether scrolling is possible
based on a sentinel.Modifier and Type | Class and Description |
---|---|
static class |
SentinelStrategy.Getter
A
Finder for sentinel. |
static class |
SentinelStrategy.MorePredicateGetter
Decorates a
SentinelStrategy.Getter by adding another Predicate . |
Modifier and Type | Field and Description |
---|---|
static SentinelStrategy.Getter |
FIRST_CHILD_GETTER
Returns the first child as the sentinel.
|
static SentinelStrategy.Getter |
LAST_CHILD_GETTER
Returns the last child as the sentinel.
|
static SentinelStrategy.Getter |
SECOND_CHILD_GETTER
Returns the second child as the sentinel.
|
static SentinelStrategy.Getter |
SECOND_LAST_CHILD_GETTER
Returns the second last child as the sentinel.
|
Modifier | Constructor and Description |
---|---|
protected |
SentinelStrategy(SentinelStrategy.Getter backwardGetter,
SentinelStrategy.Getter forwardGetter,
Direction.DirectionConverter directionConverter) |
Modifier and Type | Method and Description |
---|---|
void |
beginScrolling(DroidDriver driver,
Finder containerFinder,
Finder itemFinder,
Direction.PhysicalDirection direction)
Called only if this step is at the beginning of a series of scroll steps with regard to the
given arguments.
|
void |
doScroll(UiElement container,
Direction.PhysicalDirection direction)
Performs the scroll action on
container . |
void |
endScrolling(DroidDriver driver,
Finder containerFinder,
Finder itemFinder,
Direction.PhysicalDirection direction)
Called only if this step is at the end of a series of scroll steps with regard to the given
arguments.
|
Direction.DirectionConverter |
getDirectionConverter()
Returns the
Direction.DirectionConverter . |
protected UiElement |
getSentinel(DroidDriver driver,
Finder containerFinder,
Direction.PhysicalDirection direction) |
java.lang.String |
toString()
It is recommended that this method return a description to help debugging.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
scroll
public static final SentinelStrategy.Getter FIRST_CHILD_GETTER
public static final SentinelStrategy.Getter LAST_CHILD_GETTER
public static final SentinelStrategy.Getter SECOND_LAST_CHILD_GETTER
Sometimes uiautomatorviewer may not show the anchor as the last child, due
to the reordering by layout described in UiElement.getChildren(io.appium.droiddriver.finders.Predicate<? super io.appium.droiddriver.UiElement>)
.
This is not a problem with UiAutomationDriver because it sees the same as
uiautomatorviewer does, but could be a problem with InstrumentationDriver.
public static final SentinelStrategy.Getter SECOND_CHILD_GETTER
protected SentinelStrategy(SentinelStrategy.Getter backwardGetter, SentinelStrategy.Getter forwardGetter, Direction.DirectionConverter directionConverter)
protected UiElement getSentinel(DroidDriver driver, Finder containerFinder, Direction.PhysicalDirection direction)
public final Direction.DirectionConverter getDirectionConverter()
ScrollStepStrategy
Direction.DirectionConverter
.getDirectionConverter
in interface ScrollStepStrategy
public void beginScrolling(DroidDriver driver, Finder containerFinder, Finder itemFinder, Direction.PhysicalDirection direction)
ScrollStepStrategy
beginScrolling
in interface ScrollStepStrategy
driver
- a DroidDriver instancecontainerFinder
- Finder for the container that can scroll, for instance a ListViewitemFinder
- Finder for the desired item; relative to containerFinder
direction
- specifies where the view port will move instead of the fingerpublic void endScrolling(DroidDriver driver, Finder containerFinder, Finder itemFinder, Direction.PhysicalDirection direction)
ScrollStepStrategy
endScrolling
in interface ScrollStepStrategy
driver
- a DroidDriver instancecontainerFinder
- Finder for the container that can scroll, for instance a ListViewitemFinder
- Finder for the desired item; relative to containerFinder
direction
- specifies where the view port will move instead of the fingerpublic java.lang.String toString()
ScrollStepStrategy
toString
in interface ScrollStepStrategy
toString
in class java.lang.Object
public void doScroll(UiElement container, Direction.PhysicalDirection direction)
ScrollStepStrategy
container
. Subclasses can override this to customize the
scroll action, for example, to adjust the scroll margins.doScroll
in interface ScrollStepStrategy
container
- the container that can scrolldirection
- specifies where the view port will move instead of the finger