+ 2
When i try to login google using selenium webdriver ?
When i try to login google using selenium webdriver google block login and say you using unauthorized browser .. How to bypass or login google using selenium
1 Resposta
+ 1
What browser are you using? Google Chrome is likely best.
What is the user agent that your driven browser sends to the server? You could print this value by getting your web driver and with something like:
print(driver.execute_script("return navigator.userAgent"))
The main reason I ask is that some programmer-controlled browsers sometimes make that programmer-controlled nature obvious in the user agent. When I used a Chrome driver with Selenium's Python version, the user agent looked quite normal but maybe yours is more easily recognized. Google doesn't want their services hit with fully automatic clients like you're writing so they have motivation to block clients like PhantomJS and puppeteer.
Is reCAPTCHA or noCAPTCHA features showing when you get the unauthorized browser message? These human-detecting features show periodically when I try to log into gmail and would be nearly impossible to overcome pro-grammatically.
You're trying to sign into gmail.com more specifically, right?
If you're ultimate goal is to access Google's services, you would likely be happier using Google's official API's. Google's services such as gmail to read or send email, access Google Calendar, Google Maps, Google drive to read or write documents... Selenium might seem like a shortcut to accesssing Google services without learning the API's and how to authenticate for them but Selenium code tends to easily break especially on sites where the authors discourage web scraping. I'm worried to test it because Google could close some of my gmail accounts over terms of use violations.