I've got 3 seekbar in my app on the same page:
I am trying to automate my app with Appium and C#, i am trying to move the seekbar by ID. The first one works like expected, but the other 2 cant be located by their id, error message:
System.InvalidOperationException: The coordinates provided to an interactions operation are invalid. (InvalidElementCoordinates)
My method:
public void moveSeekBar(string id, double valueToMove, AppiumDriver<IWebElement> driver)
{
IWebElement seek_bar = driver.FindElement(By.Id(id));
//IWebElement seek_bar = driver.FindElement(By.XPath("//android.widget.SeekBar[@resource-id='" + id + "']"));
int start = seek_bar.Location.X;
int end = seek_bar.Size.Width;
int y = seek_bar.Location.Y;
TouchAction action = new TouchAction(driver);
int moveTo = (int)(end * valueToMove);
action.Press(start, y).MoveTo(moveTo, y).Release().Perform();
}
And the maincode:
string exam = "seekbarExam";
string assessment = "seekbarAssessment";
string homework = "seekbarHomework";
noten.moveSeekBar(exam, 0, driver);
Thread.Sleep(2000);
noten.moveSeekBar(exam, 0.4, driver);
Thread.Sleep(2000);
noten.moveSeekBar(assessment, 0, driver);
Thread.Sleep(2000);
noten.moveSeekBar(assessment, 0.3, driver);
Thread.Sleep(2000);
noten.moveSeekBar(homework, 0, driver);
I also tried to get the ID via XPath but obviously its not working because he seems to have a problem with the id.
I also used google but couldnt find someone with a similiar problem, maybe someone got a solution?