1

I am trying to run some automated tests on amazon.com by using Selenium Webdriver. I tried to log in to the system but after entering the password, system either directs to “Verification needed” page and says “We will email you a code to verify your identity. This is required when something about your sign-in activity changes, like signing in from a new device or location.”

or directs to “wrong password or email” page (eventhough I try correct account information).

So my question is: How can I handle that two factor authentication in my test script?

Note: I am using ChromeDriver and Java

Ishita Shah
  • 3,955
  • 2
  • 27
  • 51
n3rdm
  • 13
  • 1
  • 3
  • using selenium: open email account, find the email with link, click on link. Email is not any different than other web pages – timbre timbre May 30 '18 at 22:07
  • You could also work with an email API. If using gmail, google has a decent api for both Java and Python: https://developers.google.com/api-client-library/ – cacti5 May 30 '18 at 23:09

1 Answers1

2

there are two possible approaches:

first one, you can as Kiril S mentioned, get the link from email (mailinator.com is fine inbox for such testing).

second approach is avoiding the second verification with existing browser profile. Selenium uses a temporary profile, that's probably the reason of the second verification. I'm using existing browser profile (firefox), see Selenium Chromedriver - Open Chrome Normally. For Chrome should be similar.

pburgr
  • 1,722
  • 1
  • 11
  • 26