I am using appium1.4.13 and ios platform. Here is my test scenario. The contacts are listed in a table as cells. The contact in every cell can be swiped to left and then a delete button appears. The delete button can be found by appium, but error occurs when trying to click on it. I'm sure the button is visible on the screen after swiping. I don't know why deleteBtnE.isDisplayed() is false even after waiting for some time.
Could someone do me a favor on this? It blocks testing delete feature. Thanks.
Code:
WebElement tableCellE = driver.findElements(By.className(xxx)).get(5);
int y = tableCellE.getLocation().getY();
int width = driver.manage().window().getSize().width;
driver.swipe(width * 3 / 4, y, width / 2, y, 1000);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
deleteBtnE = driver.findElement(By.xpath(pf.deleteBtnXpath));
System.out.println("is displayed? " + deleteBtnE.isDisplayed() + ===X==="+deleteBtnE.getLocation().getX()+"===Y==="+deleteBtnE.getLocation().getY());
Output:
is displayed? false===X===307===Y===373
org.openqa.selenium.WebDriverException: An error occurred while executing user supplied JavaScript. (WARNING: The server did not provide any stacktrace information)