Java-client 2.1.0 released

HI, I Tried to perform a swipe with this method. I don’t have error message in Appium but it doesn’t work.

I use this code to initialize the driver:

    import io.appium.java_client.AppiumDriver;
    import io.appium.java_client.ios.IOSDriver;
    import org.openqa.selenium.OutputType;
    import org.openqa.selenium.WebDriver; 
    import org.openqa.selenium.remote.Augmenter; 
    import org.openqa.selenium.remote.DesiredCapabilities; 
public class Application {
            private final static String APPIUM_PORT = "4723";
             private final static String APPIUM_HOST = "";
             public static AppiumDriver driver;     
		         capabilities.setCapability("platformName", "iOS"); 
            setDriver(new IOSDriver(new URL("http://" + appiumHost + ":" + appiumPort + "/wd/hub"), capabilities));

… and this code to perform the swipe:

public static void testSwipe(){
MobileElement element = (MobileElement) driver.findElement(By.xpath(“//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[2]”));; // OK
element.swipe(SwipeElementDirection.LEFT, 1000); // Test Swipe #1 : KO
driver.swipe(300, 400, 10, 400, 500); // Test Swipe #2 : KO

I am trying to use this new method with IOS automation and it is working but it is slow what is the second parameter 1000 do?

Hi @okiichinpo,

I’m guessing you’re talking about the first post in this thread. I believe the 1000 refers to the duration of the command in milliseconds.

@awang So does that mean it will swipe for that long? What I am trying to do is find an element that is not on the screen.

@awang Thanks for responding btw

@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.

Please help me.


scrollTo not working. i am using java client 2.1.0. jar file.

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.