Error: timeout of 240000ms exceeded

Device : Android
Appium Version : 1.22
Client : Java

I have a Native app and for certain scenarios chrome will be opened from the app. To interact with the web view, I click on a button to open chrome browser from the app, switch to WebView. Till here everything is fine. In Chrome browser I have to navigate through different pages and do some validations. During this page navigation, one pages didn’t load and I got this exception - Error: timeout of 240000ms exceeded. This is happening everytime that specific page is down. So is there anyway to handle this timeout. I tried pageLoadTimeout, assuming if a WebView does not load in given timeout, exception will be thrown. But got exception that pageLoadTimeout method is not implemented, when initializing driver using native app. Also tried, “uiautomator2ServerReadTimeout” which is also not changing the timeout behaviour. Can someone please help me here to reduce the timeout. I don’t want to wait for 4 minutes + the usual test execution time. Thanks

Can someone please help me here.

Why is the page down? Sounds like a bad testing environment. Is there any way you could check that the page is up before running automation? This doesn’t sound like an Appium problem.

Maybe do a quick curl on the page to see if you get an http 200. If you get a 404, for example, don’t run the test.

Thanks for the reply @wreed
It’s a domain on which we don’t have any control. So if there is any deployment happening or due to smoother reason that domain will be down.
It’s an Appium issue as when the page is down Appium takes more than 4 minutes to respond. I am looking for some capability which will override this long wait.

I still think your best bet is to check the page before the test is run. Here is a curl script that will do just that:

curl -I -s -w "%{http_code}\n" -o /dev/null http://www.google.com

On a 200, run the test. Otherwise you could skip it or just stop running.

Good luck.

OK Thanks for the reply @wreed