Other methods to swipe until element is found

Is there any other method which can be use to swipe until element is found.

Currently I am using
driver.executeScript(“client:client.swipeWhileNotFound(“LEFT”, 200, 2000, ‘NATIVE’, “xpath=//*[@Text=‘submit’]”, 0, 1000, 5, true)”);

but sometime it works and sometime not. So I am in search of other methods which are similar to swipeWhile NotFound method

You can try playing with the command parameters - e.g increase the swipe time to perform smaller swipes, or increase the number of times you are swiping

https://docs.experitest.com/display/TD/SeeTestAutomation-+SwipeWhileNotFound

it’s usually a stable command… just jiggle with it a-bit to get to the write numbers :slight_smile:

Does swipeWhileNotFound work in non-instrumented mode ?? I don’t see the swipe occurring. Please advise as to what the alternative might be in non-instrumented mode.

swipeWhileNotFound should work in non-instrumented mode. I tested it on the device settings as well as on an application.

Usually i include @hidden in the xpath query to better understand if the element is hidden or not.

driver.executeScript("client:client.swipeWhileNotFound(\"Down\", 50, 2000, \"NATIVE\", \"//* 
[@text='Trending deals' and @hidden='false']\", 0, 1000, 5, true)");

I figured out this morning that @onScreen attritbute was needed if one actually wanted to “click” an element that may not have been displayed on the UI yet. Thanks

1 Like