Appium retries so many times to check the element is visible or not on the page

Hi Team,

why appium retries so many times to check the element, is there any way by which we can set the no. of retries ?

[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/E2B0EB99-000C-4090-879F-603E9BCA7261/elements] with body: {“using”:“xpath”,“value”:"//[starts-with(@name,‘Settings’) and @visible=‘true’]"}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:[],“sessionId”:“E2B0EB99-000C-4090-879F-603E9BCA7261”,“status”:0}
[debug] [BaseDriver] Waited for 2692 ms so far
[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/E2B0EB99-000C-4090-879F-603E9BCA7261/elements] with body: {“using”:“xpath”,“value”:"//
[starts-with(@name,‘Settings’) and @visible=‘true’]"}

It happens more than 10 times, anyone please help m in this. Thanks in advance.

Hello, Shubham

Yes, you can set the waiting time for element searching.
Its the “implicitlyWait” function that can be found maybe in AppiumDriverBuilder in your project, depends how you wrote it.

So, basically you should find this, somewhere in your project:

iosDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

The first argument that implicitlyWait function accepts is how many seconds should the driver wait to find an element. In my case, is 30 seconds. You can set it to less if you wish to work faster. But that depends what kind of app you are testing. Sometimes, you need to wait more for some elements to show up. If you are facing an app which communicates with backend a lot, then 30 seconds should be fine. If its more as an static app, then you should put less.

I hope that helped! :slight_smile:

1 Like

Hello @bogatoiucatalin,

Thanks for your valuable information, in my case also it is:

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

I will update it. Thanks

1 Like

@bogatoiucatalin - It worked, Thanks a lot :slight_smile:

1 Like

I’m glad it did. With pleasure. :slight_smile:

1 Like