Is There any additional commands for wait for page load in Android/iOS devices?

Is There any additional commands for wait for page load in Android/iOS devices?

I am executing test case from Appium Studio,most of the time test case failed due to synchronization issue
becos it try to find UI element before loading page,

Pls give the solution for wait for page load,it will very helpful for me,

you can use the ExpectedConditions :

example :

WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(By
        .xpath("//android.widget.Button[contains(@text, 'Log In')]")));

Hi Tom,

Thank for tour reply.

but I need permanent solution for page load,I can’t add wait element test step for all element,

And If provide implicit wait ,it will wait for all element,so I don’t need this,

more over if i m not knowing whether element are loaded or not in the page,how can i apply wait element function?,

Pls guide me in this issue?

Hi Michael

I’ve added a custom function to Appium Studio

you’ll need to download the version below
Windows
http://d242m5chux1g9j.cloudfront.net/AppiumStudio_windows_11_3_65.exe
MAC
http://d242m5chux1g9j.cloudfront.net/AppiumStudio_macos_11_3_65.dmg

then you can use the commad

hybridWaitForPageLoad(timeout [milliseconds])

to use it you’ll need to use the following syntax

driver.ExecuteScript("client:client.hybridWaitForPageLoad(10000)");

Please, let me know if this solves your issue

regards,

Tom

Hi Tom,

I had installed your “AppiumStudio_macos_11_3_65.dmg” and then I tried your code with web view context ,

and also I tried on “AppiumStudio_macos_11_2_41.dmg” version both not working

driver.Context=“WEBVIEW_1”;
driver.ExecuteScript(“client:client.hybridWaitForPageLoad(60000)”);

I got below error

An exception of type ‘System.InvalidOperationException’ occurred in WebDriver.dll but was not handled in user code


Additional information: javascript error (javascript error. An unknown server-side error occurred. status=‘false’. Failed to complete internal method: ‘hybridWaitForPageLoad args: [60000]’, details: Failed to wait for hybrid page to load) (UnexpectedJavaScriptError)

Can you share some more details on your script?

Are you sure you have the webview context available at the time of running the command?

if you debug your script, and put a breakpoint before you run the ExecuteScript command, will you see the web elements and able to interact with them?

I have verified webview context status,it showing document node elements, before executing ExecuteScript command