Hello @Telmo_Cardoso ,
Thank you very much for fast response. But we still failed to catch the message
Here is part of our code
private boolean catchCode(){
gestSwipeVertical(driver, 0.05, 0.9, 0.5, 1000);
logger.debug("Page Source:\n" + driver.getPageSource() + "\n\n");
try{
WebElement elem =driver.findElement(By.xpath("//*[contains(text(),'Your code')]"));
if ( elem == null){
logger.info("Code SMS caught, trying to extract text");
code = elem.getAttribute("name");
logger.info("Code SMS " + code);
//TODO - swipe up to close the panel - gestSwipeVertical(driver, 0.05, 0.9, 0.5, 1000);
return true;
} else {
logger.error("Code SMS not caught ");
return false;
}
} catch (Exception e){
logger.error("Code SMS not caught ");
return false;
}
}
private void gestSwipeVertical(AppiumDriver<WebElement> driver, double startPercentage, double finalPercentage, double anchorPercentage, int duration) throws Exception {
Dimension size = driver.manage().window().getSize();
int anchor = (int) (size.width * anchorPercentage);
int startPoint = (int) (size.height * startPercentage);
int endPoint = (int) (size.height * finalPercentage);
new TouchAction(driver).press(anchor, startPoint).waitAction(duration).moveTo(0,endPoint-startPoint).release().perform();
}
I receive "Code SMS not caught" because of NoSuchElementException after line
WebElement elem =driver.findElement(By.xpath("//*[contains(text(),'Your code')]"));
On iPhone screen I can see the OTP window reached by the program, so I believe swipe works as expected, but the field with the code still not caught
Page Source printed in debug doesn't show the OTP (it still shows only source code of my application under test) so I cannot use more specific xPath
Could you, please, suggest a solution?