mail_address = '' | |
password = '' | |
from selenium import webdriver | |
UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0' | |
PHANTOMJS_ARG = {'phantomjs.page.settings.userAgent': UA} | |
driver = webdriver.PhantomJS(desired_capabilities=PHANTOMJS_ARG) | |
url = 'https://www.google.com/accounts/Login?hl=ja&continue=http://www.google.co.jp/' | |
driver.get(url) | |
driver.find_element_by_id("Email").send_keys(mail_address) | |
driver.find_element_by_id("next").click() | |
driver.find_element_by_id("Passwd").send_keys(password) | |
driver.find_element_by_id("signIn").click() |
This comment has been minimized.
This comment has been minimized.
Use this code below for the updated login screen. Tested and working.
|
This comment has been minimized.
This comment has been minimized.
@memii - when I use this code it says element not visible |
This comment has been minimized.
This comment has been minimized.
I get this following error
|
This comment has been minimized.
This comment has been minimized.
I got error
|
This comment has been minimized.
This comment has been minimized.
replace
with
|
This comment has been minimized.
This comment has been minimized.
Updated Dec 2019 (also this script will wait until the fields have loaded) # Find login field
login_field = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, 'identifierId')))
login_field.send_keys('my-email')
# Click next button
driver.find_element_by_id('identifierNext').click()
# Find password field
password_field = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, 'password')))
password_field = password_field.find_element_by_tag_name('input')
password_field.send_keys('my-password')
# Click next button
driver.find_element_by_id('passwordNext').click() |
This comment has been minimized.
This comment has been minimized.
not working now , if anybody can use it ? I got some errors. |
This comment has been minimized.
This comment has been minimized.
I am having the same issue. Tried both with ChromeDriver and FirefoxDriver |
This comment has been minimized.
This comment has been minimized.
Same issue here. |
This comment has been minimized.
This comment has been minimized.
Same issue here. |
This comment has been minimized.
This comment has been minimized.
Couldn't sign you in This browser or app may not be secure. Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in. Same issue here, too... |
This comment has been minimized.
This comment has been minimized.
I've managed it using chromedriver
|
This comment has been minimized.
This comment has been minimized.
@tiago3613 Can't be. just tested but not work. this used to work before Google didn't block login from Selenium. |
This comment has been minimized.
This comment has been minimized.
Not working on SafariDriver either. Does anyone know how Google checks for a WebDriver browser? Maybe there is a way to pass a certificate to Google that will allow login. |
This comment has been minimized.
This comment has been minimized.
I guess google now detects and blocks webdriver. I successfully set webdriver property to false using a chrome plugin (see https://intoli.com/blog/javascript-injection/) but even with webdriver property undefined, google still detects that we are using webdriver ... |
This comment has been minimized.
This comment has been minimized.
After all, you failed again like others... |
This comment has been minimized.
This comment has been minimized.
Hey guys, same problem here. Tried to use different user agent without success. |
This comment has been minimized.
This comment has been minimized.
Right, I did find a possible workaround. When I tried logging in going to google.com > then > clicking on login I really didn't work, but... by going through other Google services, such as Google My Business, it worked. I've used the following URL to login, then navigated to where I wanted from there Let me know if it works for you |
This comment has been minimized.
This comment has been minimized.
@tiago3613 Hi, Thank you for the info! |
This comment has been minimized.
This comment has been minimized.
it would seem that however, they do it is innate to the browser being driven I ran this:
Which is to say, I opened the browser with selenium and nothing else, and then proceeded to login manually, still gave the error. |
This comment has been minimized.
This comment has been minimized.
Isn't there any possible solution? |
This comment has been minimized.
This comment has been minimized.
We need to figure out a way to hide the fact that the browser is being controlled by selenium. |
This comment has been minimized.
This comment has been minimized.
I agree ^^^^ I've been experimenting with a few things, mostly centered around manipulating the user agent. I don't know if changing the user agent will be the solution, but this is just my starting point. I will update this thread as I get more info and run tests. |
This comment has been minimized.
This comment has been minimized.
Has anyone tried updating their chromedriver to remove $cdc? I tried doing this with Vim (as outlined in the above link), but I couldn't even find $cdc in my chromedriver file. That post was created some five years ago and was tested with a much older chromedriver version, so I can only imagine how many changes they've made since that time. I've also tried a few other things, various Chrome Options and a Firefox user agent: '
So no luck yet, but I'm thinking I can do a bit more with the user agent. Edits because the code wasn't formatting correctly, smh. It's good now. |
This comment has been minimized.
This comment has been minimized.
Hey, have you managed to get it working ? @jessfeliciano |
This comment has been minimized.
This comment has been minimized.
You can go to less secure apps settings and turn it on for your Google account, it must fix the problem. |
This comment has been minimized.
This comment has been minimized.
Having the same issue. I am able to login to Google "normally" via Selenium, using: After that I locate the elements, fill them in and click through. All works well. |
This comment has been minimized.
This comment has been minimized.
unfortunately this still doesn't work. Tried this for gmail-login in chrome-headless. Regards |
This comment has been minimized.
This comment has been minimized.
Worked for me with gmail-login and PhantomJs. Maybe, try using it on the fresh account to inspect the issue? |
This comment has been minimized.
This comment has been minimized.
Guys check this video https://youtu.be/HkgDRRWrZKg .. @Narcolapser @jessfeliciano @FreelanceDev217 @kemangjaka @kemangjaka @sangminleo @cchabanois-sfdc @ChrinnerRomson @cchabanois @pavelgordon @crki14 @MetaMimic |
This comment has been minimized.
This comment has been minimized.
That YouTube video very much worked for me. I suggest using it. Basic synopsis of the video is to visit the Stack Overflow login page and login with your Google account. Once you’ve completed that, open a new browser instance for whichever Google product you’d like to visit and now you are logged into the account. |
This comment has been minimized.
This comment has been minimized.
Turns out, the YouTube video fix doesn't last. After a few days of using the automation and running tests, Google has blocked my login. I'm working through this thread to see if I can interact with an existing browser. Hoping this works. |
This comment has been minimized.
This comment has been minimized.
No need to be that page strictly... you can also login through any app where you have existing account ,for example Soundcloud,etc...Dont know why that happen but for me this works a kod of days.I am also turned on "Allow less se cure app to login" |
This comment has been minimized.
This comment has been minimized.
Hmm interesting that you’ve not had any issues then. I have the allow less secure apps to login enabled as well. Might do a bit of tinkering and at the very least just use a different webpage, probably SoundCloud, like you said in the meantime. Do you add any cookies to your browser to mask the automation? |
This comment has been minimized.
This comment has been minimized.
Anyone found a bloody solution for this yet? Tried fricking everything.... |
This comment has been minimized.
This comment has been minimized.
Have you tried navigating to a site that allows you to login with your Gmail and then navigate to YouTube? The YouTube video listed above will shows this process.
…Sent from my iPhone
On Feb 24, 2020, at 7:33 AM, poop987 ***@***.***> wrote:
Anyone found a bloody solution for this yet? Tried fricking everything....
Turning on less secure apps doesn't do s***
Setting the user agent doesn't do s***
Downgrading to chrome 78 doesn't do s***
What I'm trying to do is login to youtube with Selenium (chromedriver)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This comment has been minimized.
This comment has been minimized.
The fix in the aboved video doesnt work anymore. |
This comment has been minimized.
This comment has been minimized.
Then how the hell still works for me https://prnt.sc/r8t97r /// http://prntscr.com/r8tccb >.< |
This comment has been minimized.
This comment has been minimized.
Just curious Nexus, with your automations, which Google products do you log into?
…Sent from my iPhone
On Feb 27, 2020, at 10:45 PM, NexusPrOlgtm ***@***.***> wrote:
Then how the hell still works for me https://prnt.sc/r8t97r >.<
Try to use any app where you connect with googe... i am even turned on option "Dont allow less secure access", and still is possible to login because this goes through apps which google flag as safe :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This comment has been minimized.
This comment has been minimized.
Well it depend what i need... for example if i want to make SoundcloudFollow automation then login to Soudcloud, if its something with Instagram then Instagram,Pintrest ...and so on....i have many accounts connected with google so i can choose any of them. |
This comment has been minimized.
This comment has been minimized.
Any update on how to bypass? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I wrote a javascript file to login. I made two tests:
|
This comment has been minimized.
This comment has been minimized.
Does anyone find a solution for logging in? |
This comment has been minimized.
This comment has been minimized.
In my case, first I go to some website that can log in via target google account, and type e-mail and password. |
This comment has been minimized.
This comment has been minimized.
Hi everybody! Really nice to meet you. |
This comment has been minimized.
This comment has been minimized.
https://youtu.be/HkgDRRWrZKg @kemangjaka @GianellaVezzoni @AsmaaFailat ...try this metod with login through app connected to Google. |
This comment has been minimized.
This comment has been minimized.
I created an anonymous login to post this because I don't want to be blocked :-) It seems this is not a detection of WebDriver. I assume it has to do with the clean profile the browser creates and that it is failing to accept some cookies or something. I instruct Chrome to use my regular profile. This solved my problem.
|
This comment has been minimized.
This comment has been minimized.
Has anyone tried using something other than Selenium? |
This comment has been minimized.
This comment has been minimized.
I have figured out how to avoid the "Secure login" issue. Open the automated browser and manually create an account in the automated window itself. This account can log in inside the automated browser. Give it a shot |
This comment has been minimized.
This comment has been minimized.
I have successfully bypassed the "This browser may not be secure" message in Node.js by using puppeteer, puppeteer-extra, and puppeteer-extra-plugin-stealth. The key is to use version 2.4.5 of the stealth plugin and not the latest release. Here is the relevant code:
You can view the rest of the code on the Github for homebridge-nest-cam. Edit: I've cleaned this up and added it to a Github gist. |
This comment has been minimized.
This comment has been minimized.
Ich habe die Lösung gefunden (ich hoffe ihr könnt mich auf Deutsch verstehen : ) ). Der Trick ist folgender: Ihr öffnet die folgende Seite mit Selenium hier der Link time.sleep(5) time.sleep(5) time.sleep(5) |
This comment has been minimized.
This comment has been minimized.
Selenium with Java Finally I did it but its little tricky and achieve the following scenario Please let me know if help is need to complete the task No need to create new account, just use your existing one .... Thank you |
This comment has been minimized.
This comment has been minimized.
Can't auto but you can login google account with your hands for chrome profile via command line.
|
This comment has been minimized.
This comment has been minimized.
i found a solution to this problem which works successfully.... when the automated browser is opened and then navigate to the other service you want |
This comment has been minimized.
This comment has been minimized.
Hey! After researching into this to find the most practical way for a very long time, I think I've got it! This link comes from the oauth playground, which is an official tool Google provides to test oauth applications. It worked for me as of Tuesday, September 15th, 2020 with a Canadian account and IP. |
This comment has been minimized.
This comment has been minimized.
hi, thx a lot buddy, it work for me also |
This comment has been minimized.
This comment has been minimized.
Hi, thanks, just fantastic, it's work for me also ! |
This comment has been minimized.
This comment has been minimized.
**Tysm also worked for me |
This comment has been minimized.
This comment has been minimized.
i tried first time and failed, and tried with my second account and worked, and i think it's because less secured apps was enabled for the second account but anyways how's this happening, how's google able to track us, and what if i disable js, will this work? |
This comment has been minimized.
This comment has been minimized.
Does this work for chrome? |
This comment has been minimized.
This comment has been minimized.
Thank you so very much. Helped me save several hours of figuring out how to get it working. |
This comment has been minimized.
This comment has been minimized.
Thanks bro !!!! ... 19/11/2020 is work |
This comment has been minimized.
This comment has been minimized.
Hi all, I'm very new to this line of work. I am trying to build a personal application to sign in to a google service using Python and selenium and have run in to this same problem. I have gone to the Google OAuth playground page but I'm not sure what I need to do there to authorize my program. Could someone please give me steps for the OAuth tool or direct me to where I can learn what I need to use it? |
This comment has been minimized.
This comment has been minimized.
@nstaehler what exactly are you trying to do? Are you trying to use selenium to log into your google account? If not, this gist (my comment) is not for you. |
This comment has been minimized.
This comment has been minimized.
I am trying to write a python program that can log into a google voice account and interact with the page (i.e. sign in, dial based on keyboard inputs) |
This comment has been minimized.
This comment has been minimized.
The link I shared allows Selenium bots to log into google, and not be picked up by extensive captcha checking. You can use that link to make your bot log into Google, then do whatever you wish on |
This comment has been minimized.
This comment has been minimized.
Also, since I helped you guys, mind giving me some rep/upvotes on Stack Overflow? https://stackoverflow.com/a/64917489/13105088 I'm quite a noob, so am really in need of some Stack rep |
This comment has been minimized.
This comment has been minimized.
With your links I can't enter my password. It raises the NoSuchElement error but the email worked perfectly from the first time. I tried using xpath and class_name but to no result. Helpp.... |
This comment has been minimized.
This comment has been minimized.
is this how to do it? ` driver = webdriver.Chrome() |
This comment has been minimized.
This comment has been minimized.
Um... yes, the beginning goes like that @Jmart10 |
This comment has been minimized.
This comment has been minimized.
@ochen1 I am suppose to enter the login info in the script for my google account but is this a way to by pass the "Chrome is being controlled by automated test software" notification? I want to be able to login to google account without the 2FA with the selenium script. pls advise |
This comment has been minimized.
This comment has been minimized.
No, the notification doesn't need to be bypassed. I'm pretty sure there's a command line flag for that. Don't quote me tho The link I posted is a way to bypass Google blocking you from logging in because you're using Selenium, which is apparently something they can detect. And sorry, I don't have a script handy. I think I will put it into a Gist if I make one and link it here |
This comment has been minimized.
This comment has been minimized.
@ochen1 so we still need to do 2FA every time we try to login with selenium? |
This comment has been minimized.
This comment has been minimized.
@Jmart10 No, you do not. You just have to simply log in via the link I sent with Selenium. |
This comment has been minimized.
This comment has been minimized.
It works, I can login. |
This comment has been minimized.
This comment has been minimized.
work successfully. |
This comment has been minimized.
This comment has been minimized.
I have a two step verification ON on my gmail account which can't be disabled. Is there any workaround to it? by cookies maybe |
This comment has been minimized.
This comment has been minimized.
@raidfoxx what do you mean when you say "can't be disabled"? Have you tried going to your Google My Account settings and disabling it from there? |
This comment has been minimized.
This comment has been minimized.
@ochen1 Apparently my company uses gsuite account where 2FA can't be disabled |
This comment has been minimized.
This comment has been minimized.
Sure. You can launch chrome (from selenium) with chrome options Then, go to the link I sent. Log into your Google account. Close the chrome instance. Your selenium script now no longer needs to do the login. Now, you will just need to remember to log in like this every week or so. |
This comment has been minimized.
This comment has been minimized.
Hey @ochen1 and everyone else, `from selenium import webdriver driver = webdriver.Chrome() driver.find_element_by_xpath('//*[@id="identifierId"]').send_keys('MyMail') driver.find_element_by_xpath('//*[@id="identifierNext"]/div/button/div[2]').click()` |
This comment has been minimized.
This comment has been minimized.
Hi, @ochen1, do you know if this is still working? |
This comment has been minimized.
This comment has been minimized.
This method did not work anymore |
This comment has been minimized.
This comment has been minimized.
same |
This comment has been minimized.
This comment has been minimized.
Just verified this today. Doesn't work anymore on the same Canadian account and IP. I will keep looking for a solution to this. |
This comment has been minimized.
This comment has been minimized.
It seems to be broken again. I could still use it on my PC that I already logged in with earlier, but with a new PC and location, it throws the unsafe browser error. |
This comment has been minimized.
This comment has been minimized.
Right now there seems to be no solution for automatically logging in selenium webdriver.
You could even skip the steps 1 and 2 by just using your default chrome profile that is probably already logged in on Google. Here's my implementation of the steps in Typescript if someone's interested: |
This comment has been minimized.
Is this still working? Thank you! Google has changed its login screen. Any new gist?