This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 5
Jan 2019

seekbar

Unable to automate this seekbar feature . I should drag this seekbar to some %. Working on Android device.

HTML for referance:

Please help me to automate this feature. I am using corejava, appium and selenium to write code. Please help me with a code to automate the functionality.

  • created

    Jan '19
  • last reply

    Jan '19
  • 4

    replies

  • 239

    views

  • 3

    users

  • 2

    links

Thanks Wreed for your reply. Yes i have tried couple of methods using Touch Actions, but did not work . Below is the code:

public void testSeekbar(){

	//Get Start co-ordinate of seek bar
	int start = seek_Bar.getLocation().getX();
	System.out.println(start);
	
	// Get Location of seekbar vertically
	int y = seek_Bar.getLocation().getY();
	System.out.println(y);
	
	// Get Width of Seek Bar
	int end = seek_Bar.getSize().getWidth();
	System.out.println(end);
	
	// Create object of Touch Actions class
	TouchAction action = new TouchAction(driver);
	
	// Move it till end
	
	
	action.longPress(start, y).moveTo(end, y).release().perform();
	//action.press(start, y).moveTo(end, y).release().perform();

Second one:

Dimension dim = seekbar16.getSize();
System.out.println(dim);
int height = dim.getHeight();
int width = dim.getWidth();
int x = width/2;
int top_y = (int)(height0.80);
int bottom_y = (int)(height
0.20);
System.out.println(“coordinates :” + x + " "+ top_y + " "+ bottom_y);
driver.swipe(x, top_y, x, bottom_y, 5000);
TouchAction ts = new TouchAction(driver);
ts.press(x, top_y).moveTo(x, bottom_y).release().perform();

None of them is working for me.

I have just done this using this method in the below thread:

Hopefully it works as smoothly for you as it did for me.

I don’t have element id as seekbar, so i am unable to find the element. I have given the html content for seek bar, can u please tell me how to find it with the above html?