How to wait for a page load? I have a scenario where after I am trying to do a button click which will navigate to a new screen. On this screen, I need to check for elements.
I have inserted a thread.sleep(2000) or explicit wait for the element to be loaded. The elements that I am trying to search in the new screen are visible in appium scripts sometimes, and failing most of the times.
Is there any other approach to search for elements?
//1 MobileElement el1 = (MobileElement) driver.findElement(MobileBy.id("tvEmail")); //MobileElement el1 = (MobileElement) //2 driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().resourceIdMatches(\".*tvEmail\")")); //3 MobileElement el1 = (MobileElement ) driver.findElement(By.id("com.app.id:/tvEmail"));