How can we find the element coordinates through code in appium

how can we find the element coordinates through code in appium

Using java-client:

driver.findElement(By.id("my id")).getLocation().getX();

For X coordinate for example.

2 Likes
driver.findElement(MobileBy.id("some_ID")).getSize().getWidth();