How to move (drag) seek bar in appium

automate-seekbar-using-appiumA seek bar in any android handset or emulator is kind of a progress bar but this one is draggable, user can touch on the round shape or thumb, then can move towards right or left.

E.g – increase or decrease of volume or screen brightness.

Let’s see how we can automate the seek bar to move left or right.

Connect your mobile to PC and run below test

[Used ApiDemos.apk]

java-client.jar version 4.0 on wards,

scrollTo() method is deprecated, so we have write our own method to scroll through the screen.

Update: on java-client version 5.0.0 BETA on wards

swipe() method deprecated, one workaround to swipe is to use io.appium.java_client.TouchAction


From the above code, instead of

we can use

 

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

4 Responses

  1. Payal says:

    I tried executing the above code. But I am running into this issue:
    org.openqa.selenium.WebDriverException: Method has not yet been implemented (WARNING: The server did not provide any stacktrace)
    At line : appium.swipe(0,scrollStart,scrollEnd,0,2000);

    I am using saucelabs to run my mobile tests
    Driver info: io.appium.java_client.ios.IOSDriver
    appiumVer “1.5.3”

    Please let me know what the issue is

  2. sunilpatro1985 says:

    Hi Payal,

    Can you update your java-client jar version and retry, I am using java-client version 4.0 or above.

  3. Vinoth says:

    I used the same code for my app, when i run the code i get the below issue
    :org.openqa.selenium.WebDriverException: Support for this gesture is not yet implemented. Please contact an Appium dev (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 11 milliseconds
    Build info: version: ‘unknown’, revision: ‘1969d75’, time: ‘2016-10-18 09:43:45 -0700’
    System info: host: ‘Rinsofts-Mac-mini-2.local’, ip: ‘192.168.1.120’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.11.6’, java.version: ‘1.8.0_111’
    Driver info: io.appium.java_client.ios.IOSDriver
    Java -client version is 5.0BETA.

  4. sunilpatro1985 says:

    Hi Vinoth,
    From java-client.jar 5.0.0 on wards, swipe() deprecated, so you can replace line 49 with this

    new TouchAction(driver).press(0, scrollStart).waitAction(2000).moveTo(0, scrollEnd).release().perform();

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: