How can I provide a delay between clicks of events in UiAutomator Android.
The first event enters the URL into the 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 ends, I need to check the second event.
The second event checks the description of the contents of the 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 does not seem to work.
I just want the application to wait a while before checking the second event.
I know that 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 do not know how to use these methods.
Please offer me an example of how to use them.
Any help would be appreciated.
Thanks!
source share