How can I provide delay between event clicks in UiAutomator Android.
First event is entering a url in EditText :
new UiObject(new UiSelector().text("Search here")).setText("abc.com");
getUiDevice.waitForIdle(15000);
Here I am loading a webpage inside a webview. So when url loading finishes , then I need to check for second event.
Second event is checking content description of a object :
UiObject curClass = new UiObject(new UiSelector().className("android.widget.RelativeLayout"));
UiObject yCur = curClass.getChild(new UiSelector().description("ye"));
getCurCol();
public void getCurCol() throws UiObjectNotFoundException {
try {
if (yCur.getContentDescription() != null)
report.append("Success");
} catch (Exception e) {
System.err.println("\nCaught Exception: " + e.getMessage());
}
But this doesn't seem to be working.
I just want the app to wait for some time before checking for the second event.
I know these three methods are provided for delay in UI Automator -
public void waitForIdle(long timeout)
public void waitForIdle()
public boolean waitForWindowUpdate(String packageName, long timeout)
But I don't know how to use these methods.
Please suggest me a example how to use these.
Any help would be appreciated.
Thanks!
UiDevice
provides a few methods that may work for you:
public void waitForIdle(long timeout)
public void waitForIdle()
public boolean waitForWindowUpdate(String packageName, long timeout)
I am no expert in UIautomator, but this can be done with Thread.sleep().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With