Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

google chrome - GMail is blocking login via Automation (Selenium)

I am using selenium to automate a mail verification process in a web application. I have a script already in place to login to gmail and read an activation mail received on the account. The script was perfectly working till yesterday but today I am facing a problem.

Screenshot of issue

Additional Screenshot of issue Additional Screenshot of issue

Gmail is not allowing sign in if the browser is launched with selenium. Says,

You're using a browser that Google doesn't recognize or that's setup in a way that we don't support.

  • I have tried upgrading chromedriver version to 76.0.0 as I am using chrome version 76.0.3809.100(64 bit). (Previously used chromedriver 2.45) Still, the problem persists.
  • Verified that this issue occurs even if I use Firefox instead of Chrome for automation.
  • Verified that Javascript is enabled in the browser
  • Gmail is not asking for any OTP or recovery mail. It is simply blocking my attempt to login via automation. However I am able to login to the same account manually.

Software used: "webdriverio": "^4.14.1", "wdio-cucumber-framework": "^2.2.8"

Any help is appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After some trial and error, found out that this issue happens only in a scenario when multiple gmail accounts have already been created from the same App/IP/Device. Google somehow is marking those accounts and blocks them if they are launched by automation frameworks/extensions.

Temporary Solutions:

  • Create a fresh GMail account using a different mobile number from another device (Not recommended).
  • We should be using workarounds like nodemailer zeolearn.com/magazine/sending-and-receiving-emails-using-nodejs (as mentioned by Rahul L as a suggestion)
  • Automate temporary mail providers like Guerilla Mail or 10 Minute Mail if you are worried about only receiving mails

My humble opinion is to entirely avoid automating the UI of third party Mail applications as you cannot predict how their UI and elements will change. They might block you from launching for security purposes and they have every right to do so!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...