1

I'm testing an app where, after logging in, you create and confirm a six-digit pin. I'm just using the pin 123456 for testing. This block gets run twice:

final String PIN = "123456";
for(char c : PIN.toCharArray()){
    driver.findElementByXPath("//XCUIElementTypeKey[@label='"+c+";]").click();
    Thread.sleep(50);
}

when confirming the pin (i.e., the second time the block runs), I get the following error:

org.openqa.selenium.StaleElementReferenceException: The previously found element ""1" Key" is not present in the current view anymore. Make sure the application UI has the expected state. Original error: No matches found for Descendants matching type Key from input {(
    Application, pid: 69030
)}

Presumably, Appium is caching the internal element ID then trying to use it again. Is there a way to disable this behaviour?

This happens on iPhone 8 but not iPhone 7. Doesn't happen on any of the Android phones I have.

SIGSTACKFAULT
  • 919
  • 1
  • 12
  • 31

0 Answers0