Unable to sign into google with selenium automation because of This browser or app may not be secure.
The followings work me as well:
1. try to login stackoverflow with your google account
2. once login, go to the email
here is solution
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "chromeDriver/chromedriver.exe");
driver = new ChromeDriver();
GeneralClass te = new GeneralClass ();
driver.get("https://accounts.google.com/signin/oauth/identifier?client_id=717762328687-iludtf96g1hinl76e4lc1b9a82g457nn."
+ "apps.googleusercontent.com&as=JS6BM8cjL-8j9votansdkw&destination=https%3A%2F%2Fstackauth"
+ ".com&approval_state=!ChRoYWVvLUlNMk5hSXJWUGlaSVl2WBIfc3lSa0lueENpb29lSU5vbEVpbVNxcUZGaGNkSEJoYw%E2%88%99AJDr988AAAAAXlBKc7PzEomxSzgNqd4wLptVlf0Ny3Qx&oauthgdpr=1&xsrfsig=ChkAeAh8T8JNDxCf2Zah5fb_rQ55OMiF8KmMEg5hcHByb3ZhbF9zdGF0ZRILZGVzdGluYXRpb24SBXNvYWN1Eg9vYXV0aHJpc2t5c2NvcGU&flowName=GeneralOAuthFlow");
te.waitingForElementSendingKey(driver, By.id("identifierId"), "XXXXXXXX@gmail.com");
te.waitingForElementForClickOnly(driver, By.id("identifierNext"));
te.waitingForElementSendingKey(driver,By.name("password"), "PASSSWORD");
te.waitingForElementForClickOnly(driver, By.id("passwordNext"));
Thread.sleep(1500);
driver.get("https://mail.google.com/mail/u/0/#inbox");
Thanks Automation Google login with python and selenium shows This browser or app may be not secure
First of all don't use chrome and chromedriver. You need to use Firefox.(if not installed) Download and install Firefox. Login to Google with normal Firefox.
You need to show the Google site that you are not a robot. You can use code like this:
from selenium import webdriver
import geckodriver_autoinstaller
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
geckodriver_autoinstaller.install()
profile = webdriver.FirefoxProfile(
'/Users/<user name>/Library/Application Support/Firefox/Profiles/xxxxx.default-release')
profile.set_preference("dom.webdriver.enabled", False)
profile.set_preference('useAutomationExtension', False)
profile.update_preferences()
desired = DesiredCapabilities.FIREFOX
driver = webdriver.Firefox(firefox_profile=profile,
desired_capabilities=desired)
This can help you find your profile location.But, why Firefox?
Actually there is only one reason, chromedriver was coded by Google.
They can easily understand if it is a bot or not. But when we add user data with Firefox, they cannot understand if there is a bot or not.
You can fool Google like this. It worked for me too. I tried very hard to do this. Hope it will be resolved in you too.
How to handle browser or app may not be secure issue with web driver Selenium python?
This issue was because of the selenium chrome profile.
I have created a new chrome profile and logged into it with the email id with which I was facing this issue. Then Turn on sync.
With this chrome profile in place I can skip the login steps and directly do the main process.
Use: Chrome Options to add newly created chrome profile as an argument.
Hope this helps people who are facing similar challenge.
Google: Couldn't Sign you in (the browser or app may be insecure) using selenium automation
For anyone facing this, the easiest way is to use cookies.
Download Colab's Cookies for that particular account.
In selenium, add them to your webdriver first and then go to the notebook link.
Related Topics
What Is the Most Efficient Way to Reverse an Array in JavaScript
Passing Data to a Jquery UI Dialog
Javascript: Dynamically Creating Variables for Loops
Why How to Not Throw Inside a Promise.Catch Handler
Waiting for Image to Load in JavaScript
How to Check If an Embedded Svg Document Is Loaded in an HTML Page
Attaching Click Event to a Jquery Object Not Yet Added to the Dom
Omitting the Second Expression When Using the If-Else Shorthand
Resize Jqgrid When Browser Is Resized
Add Commas to a Number in Jquery
Node.Js Piping the Same Readable Stream into Multiple (Writable) Targets
How to Bind Bootstrap Popover on Dynamic Elements
What Is the 'Execution Context' in JavaScript Exactly
How to Catch Jquery $.Getjson (Or $.Ajax with Datatype Set to 'JSONp') Error When Using JSONp
Catching Errors in JavaScript Promises with a First Level Try ... Catch
How to Deeply Merge Two Object Values by Keys
Objects VS Arrays in JavaScript for Key/Value Pairs
How to Reset the Scale/Zoom of a Web App on an Orientation Change on the Iphone