How to Handle (drag) Seek bar in Android?

Hi,

These is easy way to use seekbar to move upto some specific postion with below code
//Locating seekbar using resource id
WebElement seek_bar=driver.findElement(By.id(“seek_bar”));
// get start co-ordinate of seekbar
int start=seek_bar.getLocation().getX();
//Get width of seekbar
int end=seek_bar.getSize().getWidth();
//get location of seekbar vertically
int y=seek_bar.getLocation().getY();

    // Select till which position you want to move the seekbar
    TouchAction action=new TouchAction(driver);

   
    //Move it 40%
    int moveTo=(int)(end*0.4);
    action.press(start,y).moveTo(moveTo,y).release().perform();

For complete explaination visit my blog -
http://qaautomated.blogspot.in/2016/02/how-to-move-seek-bar-with-appium.html

2 Likes