Home > Back-end >  How to continue automation after entering OTP manually using Selenium and Java
How to continue automation after entering OTP manually using Selenium and Java

Time:03-10

Using selenium webdriver I am testing login page and some more tabs using eclipse, maven, testng, but in Login page there is OTP verification. So I put OTP manually so. How to continue next proces as a automation?

CodePudding user response:

To continue automation after entering OTP manually using Selenium would be to use the Scanner class as follows:

driver.findElement(By.xpath("xpath_mobile_field")).sendKeys("9818414799");
scanner_user = new Scanner(System.in);
    System.out.println("Enter the OTP: ");
    String user = scanner_user.nextLine();
    driver.findElement(By.xpath("xpath_otp_field")).sendKeys(user);

References

You can find a couple of relevant detailed discussions in:

CodePudding user response:

As I understand you want to enter the OTP during the execution manually,

You can put the long wait before OTP field add `Thread.sleep(90000)` that's how you can enter the OTP manually.

Second you may ask development team to hardcode the OTP instead of
generating random.
  • Related