Xpath does not access element?

xpath doesn’t perform any action. please help me

driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAPopover[1]/UIATableView[1]/UIATableCell[3]/UIASegmentedControl[1]/UIAButton[2]")).click();

help us to help you. add into code:

int x,y;
WebElement el = driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAPopover[1]/UIATableView[1]/UIATableCell[3]/UIASegmentedControl[1]/UIAButton[2]"));
x = el.getLocation().getX + el.getSize().getWidth()/2;
y = el.getLocation().getY + el.getSize().getHeight()/2;
System.out.println(x + ", " + y);
el.click();

and check that x,y coordinates are same as you expecting.

1 Like

@Aleksei Thank you… while executing above code i have got x and y (676, 673) points but in appium inspector ,it has location: {659, 225}. How to handle it?

we have zero knowledge about your client and how it is look like. you should either investigate yourself or share screen with inspector.

@Aleksei My problem solved . I have used “driver.tap(1,9,6,1);” method .And It is working fine . there is no need to use xpath to find elements. Thanks ,Your suggestion had fruitful for me.