How to handle OTP screen which is generated from API in Selenium Webdriver-

enter image description here

  • 1
    Try to get element id or name by using the DevTools To access the DevTools, open a web page or web app in Google Chrome. Either: Select the Chrome menu Chrome Menu at the top-right of your browser window, then select Tools > Developer Tools. Right-click on any page element and select Inspect Element.
    – Lraghawan
    Feb 15, 2018 at 9:17

1 Answer 1

String userProfile= "C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\";


ChromeOptions options = new ChromeOptions();



WebDriver driver = new ChromeDriver(options);


The above code working fine for Automate the OTP verification sites, just create your local chrome trusted one time and call same browser using above code for testing. It's quite cool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.