Abhishek Boorugu
Abhishek Boorugu

Reputation: 164

How to handle browser or app may not be secure issue with web driver Selenium python?

I'm trying to automate sign in into gmail and I get to see this error.

enter image description here

I think this must be because the website is able to detect the automation and blocking it. Can you all please tell me how to overcome this? I don't see this issue with my personal account but this happens only with a common account.

Upvotes: 7

Views: 19290

Answers (4)

Abhishek Boorugu
Abhishek Boorugu

Reputation: 164

Changing the default selenium chrome profile of the automated browser worked for me.

Create a new Chrome profile or use an existing one with which you want to log in. Replace the default Selenium Chrome profile with your new profile. 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 a newly created Chrome profile as an argument.

I hope this helps people who are facing similar challenges.

Upvotes: 2

m.gibin
m.gibin

Reputation: 137

You can try undetected-chromedriver. It will not help the servers to detect Whether the request is coming from an automated browser bot.

To install you can use pip --> pip install undetected-chromedriver and the implementation will look like:

import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

options = uc.ChromeOptions()
# Configure options as needed
# options.add_argument('--headless')  # Optional, if you don't want a GUI.
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')

driver = uc.Chrome(options=options)

# Now proceed with your automation tasks as usual

driver.get("Your url goes here!")

 

It worked for me, and helped me to crack the "sign-in with Google" option".

Upvotes: 1

Bruno Sacco
Bruno Sacco

Reputation: 56

In you account profile, in Security options, try setting this option: Security settings

Upvotes: 3

Yamini
Yamini

Reputation: 11

I faced this issue. I have created dummy gmail account and now my selenium script is working fine for the same and able to login successfully.

it's not working for my personal gmail account.

Thanks !!

Upvotes: 1

Related Questions