0
I am using java with appium. I executed my code using 2 ways. One -when I am using below code it is working fine.
public class On_BoardingPages
MobileElement smsField = driver.findElement(By.id("pinEntryViewVerifyCode"));
smsField.sendKeys("XXXX");
public On_BoardingPages(AppiumDriver<MobileElement> driver) {
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
}
public void enterSMSVerificationCode(String codeVerification) {
sms_VerificationCode.sendKeys(codeVerification);
}
Second- When I am using POM and its failing
page class:
@FindBy(id = "pinEntryViewVerifyCode")
private MobileElement sms_VerificationCode;
TestClass
on_BoardingPages.enterSMSVerificationCode("XXXX");
Error:
org.openqa.selenium.NoSuchElementException: Can’t locate an element by this strategy: By.chained({By.id: pinEntryViewVerifyCode}) at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:126) at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:60) --Caused by: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for io.appium.java_client.pagefactory.AppiumElementLocator$WaitingFunction@56a4479a (tried for 1 second(s) with 500 milliseconds interval) at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:303) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:271) at io.appium.java_client.pagefactory.AppiumElementLocator.waitFor(AppiumElementLocator.java:99) at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:119)