While considering for Web application, we’ve wait for page (DOM) to be loaded function available for Selenium.
Selenium Web application : ((String)((JavascriptExecutor)driver).executeScript(“return document.readyState”)).equals(“complete”);
Likewise, Do we have any function/implementation for activities to be loaded.? Here, Static waits are taking much time. Please let me know other alternatives if any existing.
Note : Tried with wait for element to be disappear for Loading Spinn bar, wait.until(ExpectedConditions.invisibilityOfElementLocated(locator));, but no luck.
We have implemented a screen factory which detects the visible screen based on a combination of current activity and visible elements. If we are waiting for a screen change, we call the factory in a loop until the screen has changed.
You can implement wait for activity by using below logic:
long startTime = System.currentTimeMillis();
while(System.currentTimeMillis() - startTime < Time_Out)
if (getDriver().currentActivity().equals(activity))
break;