I am using nexus 5 to test. How can i choose image from gallery using appium in android. When i used following code :
driver.findElement(By.xpath("//android.widget.ImageView[@content-desc='Photo
taken on 13 May 2016 12.50']")).click();
I got such Exception:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING:The server did not provide any stacktrace information) Command duration or timeout: 50.56 seconds
Try to write it with this manner it will select only the first :
driver.findElement(By.xpath("//android.widget.ImageView[contains(@resource-id,'id of your image')]")).click();
With this code you can select any elements you want just put instead of i the element you want starting from 0 for the first one :
driver.findElements(By.xpath("//android.widget.ImageView[contains(@resource-id,'id of your image')]")).get(i).click();