SwipeWhileNotFound
Description
This command will swipe the screen in search of element. If found, the command will return true, allowing you to use it in an if-else construct.
Parameters
Name | Value | Description |
---|---|---|
direction | string | Direction to swipe: Up, down, left, right |
offset | int | Swipe offset, the distance from the bottom of the screen in pixels |
swipeTime | int | Swipe Time, swipe round duration in milliseconds. |
zone | string | Zone - Native, Web |
elementToFind | string | xpath of the element to find |
elementToFindInex | int | index of the element to find, if more than one element answers to the xpath query |
delay | int | Time to wait before sending a command (in milliseconds), delay time between swipes |
rounds | int | Maxium swipe rounds |
click | boolean | True - click the element once it's found False - don't click the element |
Usage
If your app requires scrolling up or down in search of an element to click on, you can test this activity using the swipeWhileNotFound command.
Example
info
Replace <server> with the appropriate URL.
- Public Continuous Testing Cloud - https://cloud.seetest.io/wd/hub/.
- Dedicated Continuous Testing Cloud environment - Your own domain. For example: https://company.experitest.com/wd/hub/
- On-premises Continuous Testing Cloud environment - Your designated URL. For example: https://company.com/wd/hub
Usage of SwipeWhileNotFound Command
driver = new AndroidDriver(new URL("<server>"), dc);
seetest = new SeeTestClient(driver);
...
...
if(seetest.swipeWhileNotFound("Down", 0, 2000, "NATIVE", "xpath=//*[@text='order']", 0, 1000, 5, true))
{
// if statement
}