public abstract class BaseDroidDriver<R,E extends BaseUiElement<R,E>> extends java.lang.Object implements DroidDriver
Constructor and Description |
---|
BaseDroidDriver() |
Modifier and Type | Method and Description |
---|---|
void |
checkExists(Finder finder)
Polls until a
UiElement is found using the given finder, or the
default timeout is reached. |
void |
checkGone(Finder finder)
Polls until the
UiElement found using the given finder is gone, or
the default timeout is reached. |
boolean |
dumpUiElementTree(java.lang.String path)
Dumps the UiElement tree to a file to help debug.
|
UiElement |
find(Finder finder)
Returns the first
UiElement found using the given finder without
polling and without DroidDriver.refreshUiElementTree() . |
abstract InputInjector |
getInjector() |
Poller |
getPoller()
Returns the
Poller . |
E |
getRootElement() |
boolean |
has(Finder finder)
Returns whether a matching element exists without polling.
|
boolean |
has(Finder finder,
long timeoutMillis)
Returns whether a matching element appears within
timeoutMillis . |
protected abstract E |
newRootElement() |
protected abstract E |
newUiElement(R rawElement,
E parent)
Returns a new UiElement of type
E . |
UiElement |
on(Finder finder)
Returns the first
UiElement found using the given finder. |
void |
refreshUiElementTree()
Refreshes the UiElement tree.
|
void |
setPoller(Poller poller)
Sets the
Poller . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getUiDevice
public UiElement find(Finder finder)
DroidDriver
UiElement
found using the given finder without
polling and without DroidDriver.refreshUiElementTree()
. This method is useful in
Poller.PollingListener.onPolling(io.appium.droiddriver.DroidDriver, io.appium.droiddriver.finders.Finder)
. In other situations polling is
desired, and DroidDriver.on(io.appium.droiddriver.finders.Finder)
is more appropriate.find
in interface DroidDriver
finder
- The matching mechanismpublic boolean has(Finder finder)
DroidDriver
has
in interface DroidDriver
public boolean has(Finder finder, long timeoutMillis)
DroidDriver
timeoutMillis
.
Use this only if you have no way to determine the content of current page.
There are very few occasions using this is justified. For instance, you are
looking for UiElements in a scrollable view, whose content varies based on
the scroll position. Refrain from using this method in these cases:
UiElement el = driver.on(By.anyOf(finder1, finder2, ...)); // UI is stable now, find which one is returned if (finder1.matches(el)) ...
has
in interface DroidDriver
public UiElement on(Finder finder)
DroidDriver
UiElement
found using the given finder. This
method will poll until a match is found, or the default timeout is reached.on
in interface DroidDriver
finder
- The matching mechanismpublic void checkExists(Finder finder)
DroidDriver
UiElement
is found using the given finder, or the
default timeout is reached. This behaves the same as DroidDriver.on(io.appium.droiddriver.finders.Finder)
except
that it does not return the UiElement
.checkExists
in interface DroidDriver
finder
- The matching mechanismpublic void checkGone(Finder finder)
DroidDriver
UiElement
found using the given finder is gone, or
the default timeout is reached.checkGone
in interface DroidDriver
finder
- The matching mechanismpublic Poller getPoller()
DroidDriver
Poller
.getPoller
in interface DroidDriver
public void setPoller(Poller poller)
DroidDriver
Poller
.setPoller
in interface DroidDriver
public abstract InputInjector getInjector()
protected abstract E newRootElement()
protected abstract E newUiElement(R rawElement, E parent)
E
.public E getRootElement()
public void refreshUiElementTree()
DroidDriver
refreshUiElementTree
in interface DroidDriver
public boolean dumpUiElementTree(java.lang.String path)
DroidDriver
DroidDriver.refreshUiElementTree()
is called.
The dump may contain invisible UiElements that are not used in the finding algorithm.
dumpUiElementTree
in interface DroidDriver
path
- the path of file to save the tree