public class DynamicSentinelStrategy extends SentinelStrategy
UiElement.getChildren(io.appium.droiddriver.finders.Predicate<? super io.appium.droiddriver.UiElement>)
is not reliable. This can happen, for instance, when UiAutomationDriver is
used, which skips invisible children, or in the case of dynamic list, which
shows more items when scrolling beyond the end.Modifier and Type | Class and Description |
---|---|
static class |
DynamicSentinelStrategy.ContentDescriptionUpdated
Determines whether the sentinel is updated by checking the content
description of a descendant element of the sentinel (or itself).
|
static interface |
DynamicSentinelStrategy.IsUpdatedStrategy
Interface for determining whether sentinel is updated.
|
static class |
DynamicSentinelStrategy.ResourceIdUpdated
Determines whether the sentinel is updated by checking the resource-id of a
descendant element of the sentinel (often itself).
|
static class |
DynamicSentinelStrategy.SingleStringUpdated
Determines whether the sentinel is updated by checking a single unique
String attribute of a descendant element of the sentinel (or itself).
|
static class |
DynamicSentinelStrategy.TextUpdated
Determines whether the sentinel is updated by checking the text of a
descendant element of the sentinel (or itself).
|
SentinelStrategy.Getter, SentinelStrategy.MorePredicateGetter
FIRST_CHILD_GETTER, LAST_CHILD_GETTER, SECOND_CHILD_GETTER, SECOND_LAST_CHILD_GETTER
Constructor and Description |
---|
DynamicSentinelStrategy(DynamicSentinelStrategy.IsUpdatedStrategy isUpdatedStrategy,
SentinelStrategy.Getter backwardGetter)
Defaults to LAST_CHILD_GETTER for forward scrolling, and the standard
Direction.DirectionConverter . |
DynamicSentinelStrategy(DynamicSentinelStrategy.IsUpdatedStrategy isUpdatedStrategy,
SentinelStrategy.Getter backwardGetter,
SentinelStrategy.Getter forwardGetter)
Defaults to the standard
Direction.DirectionConverter . |
DynamicSentinelStrategy(DynamicSentinelStrategy.IsUpdatedStrategy isUpdatedStrategy,
SentinelStrategy.Getter backwardGetter,
SentinelStrategy.Getter forwardGetter,
Direction.DirectionConverter directionConverter)
Constructs with
Getter s that decorate the given Getter s
with UiElement.VISIBLE , and the given isUpdatedStrategy and
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 |
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.
|
boolean |
scroll(DroidDriver driver,
Finder containerFinder,
Direction.PhysicalDirection direction)
Tries to scroll
containerFinder in direction . |
java.lang.String |
toString()
It is recommended that this method return a description to help debugging.
|
doScroll, getDirectionConverter, getSentinel
public DynamicSentinelStrategy(DynamicSentinelStrategy.IsUpdatedStrategy isUpdatedStrategy, SentinelStrategy.Getter backwardGetter, SentinelStrategy.Getter forwardGetter, Direction.DirectionConverter directionConverter)
Getter
s that decorate the given Getter
s
with UiElement.VISIBLE
, and the given isUpdatedStrategy
and
directionConverter
. Be careful with Getter
s: the sentinel
after each scroll should be unique.public DynamicSentinelStrategy(DynamicSentinelStrategy.IsUpdatedStrategy isUpdatedStrategy, SentinelStrategy.Getter backwardGetter, SentinelStrategy.Getter forwardGetter)
Direction.DirectionConverter
.public DynamicSentinelStrategy(DynamicSentinelStrategy.IsUpdatedStrategy isUpdatedStrategy, SentinelStrategy.Getter backwardGetter)
Direction.DirectionConverter
.public boolean scroll(DroidDriver driver, Finder containerFinder, Direction.PhysicalDirection direction)
ScrollStepStrategy
containerFinder
in direction
. Returns whether scrolling is
effective.driver
- a DroidDriver instancecontainerFinder
- Finder for the container that can scroll, for instance a ListViewdirection
- specifies where the view port will move instead of the fingerpublic void beginScrolling(DroidDriver driver, Finder containerFinder, Finder itemFinder, Direction.PhysicalDirection direction)
ScrollStepStrategy
beginScrolling
in interface ScrollStepStrategy
beginScrolling
in class SentinelStrategy
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
endScrolling
in class SentinelStrategy
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 SentinelStrategy