Every time I verify mail through Gmail, it shows a page "Verify It's Your page". How can I be able to enter OTP code for verification as each time I run the test cases I get new OTP code?

I want to click the activation link to activate my login account through the tellurium, but when the process goes from Gmail > sign-in and then a new page opens Verify Its You, and now for me to get verified, I have to enter OTP code.

Is it possible to achieve this scenario using Selenium?

  • Can you share more specific details? and what you have tried? Commented Dec 1, 2015 at 6:30
  • I want to click in the activation link to activate my login account through the tellurium, but when process goes from Gmail > sign in and thena new page open Verify Its You, and now how am i verified, i have to enter OTP to varify. Commented Dec 1, 2015 at 6:49

4 Answers 4


aerogear-otp-java - Java One Time Password API provides insights about how an otp is generated. It worked for okta verification, you may try this with Tellurium and see if it works out.

Here is the snippet that worked perfectly fine for me:

org.jboss.aerogear.security.otp.api.Clock otpClock = new Clock(30);
org.jboss.aerogear.security.otp.Totp totp = new Totp(secretKey, otpClock);
  • Link only answers are usually removed from this forum. you might want to write a proper solution and use the link as reference Commented Nov 23, 2016 at 15:12
  • 1
    @TESTasy added the code snippet that worked fine for me. Commented Nov 24, 2016 at 8:54
        String userProfile= "C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\";

        ChromeOptions options = new ChromeOptions();

        WebDriver driver = new ChromeDriver(options);
  • Please explain what this code does and how it answers the question.
    – Gogowitsch
    Commented Dec 27, 2019 at 21:15

There is not a simple and "clear" solution, because it's not a simple case, I guess. I see two ways how to manage it:

  • Connect Android device to PC and by using ADB gets OTP from SMS (on StackOverflow you can find a ready solution)
  • Download an application which forwarders SMS automatically on the particular email address

The second solution seems easier to implement but it's already your decision.


I might have a solution. But I'm not sure if this is the correct approach. You can download the backup codes from google for your account and then select the "use backup code" for signing into the account.

The backup codes can be stored in an excel and then can be entered sequentially. Of course, the backup code is valid only once and you'll have to download a new set once you have exhausted that. Hope it helps!

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.