public static void testSwipe(){
MobileElement element = (MobileElement) driver.findElement(By.xpath(“//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[2]”));
element.click(); // OK
element.swipe(SwipeElementDirection.LEFT, 1000); // Test Swipe #1 : KO
driver.swipe(300, 400, 10, 400, 500); // Test Swipe #2 : KO
}
@okiichinpo, yes, I believe that is what it means. The swipe will occur over a time interval of 1000 milliseconds.
For finding elements that are not on screen: I know that sometimes the element isn’t returned by Instruments. I am guessing it’s because the element hasn’t been prepared in the device or simulator memory, so you have to swipe the screen until the element is close enough to the viewable area of the screen that the element gets instantiated.
I tried to use swipe(direction, int) on a MobileElement.
But, I am not able to tune the duration so that the element is swiped to left instead of simulating a click on that element. If I set it to 500, it simply tries to swipe but not enough duration to reveal underlying options. If I keep increasing the duration upto 1000, it starts to click on that element and opens a new view.
Since this is a 2 year old thread about a two year old version of the client, I think you’d be best off trying a little newer version of the client. Try java-client 4.1.2 if you are still running Appium server 1.5.3. That one has been out a while and is pretty stable.
Otherwise, you could also try upgrading to Appium 1.6.4-beta server, along with the java-client 5.0.0-BETA4
i am using appium 1.6.4also used java client 5.0.0 still it’s not working. not able to click on a particular element. scrollToexact() also not working.
Scroll to Exact works but you need to provide additional timeout while starting appium server. I have noticed command timing out with Appium Server default timeout.