I want to use playwright to sign into my Gmail account. I employ Python 3.10 Although there is no mistake, the screen stated that I was unable to sign into my account for some reason. The screenshot is shown below.

Python code :
from playwright.sync_api import Playwright, sync_playwright
with sync_playwright() as playwright:
# Define Chrome browser options
options = {
'args': [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-first-run',
'--no-sandbox',
'--no-zygote',
'--ignore-certificate-errors',
'--disable-extensions',
'--disable-infobars',
'--disable-notifications',
'--disable-popup-blocking',
'--remote-debugging-port=9222'
],
'headless': False # Set headless option here
}
# Launch Chrome browser with options
browser = playwright.chromium.launch(**options)
# Create a new context
context = browser.new_context()
# Create a new page
page = context.new_page()
for i in range(0, 100):
num = '01703081815'
number = int(num) + i
numbers = "0"+str(number)
# Navigate to the Gmail login page
page.goto('https://accounts.google.com/v3/signin/identifier?dsh=S-1391596855%3A1680666082703684&continue=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F%3Ftab%3Dwm&emr=1&followup=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F%3Ftab%3Dwm&ifkv=AQMjQ7QIjnt4FMkK0TiFkjtzUAkNCpukXud3h6GXgdEJmiWUc6aKq5OfhTv5uWXS4k8uLLYtzU_rJg&osid=1&passive=1209600&service=mail&flowName=GlifWebSignIn&flowEntry=ServiceLogin')
# Fill in the email field and press Enter
page.fill('input[type="email"]', numbers)
page.keyboard.press('Enter')
# Wait for the password field to appear and fill it in
page.wait_for_selector('input[type="password"]')
page.fill('input[type="password"]', numbers)
# Click the sign-in button
page.keyboard.press('Enter')
# Wait for the Gmail inbox to load
# page.wait_for_selector('div[role="main"]')
# Close the browser
browser.close()
I have the same issue, and "--disable-blink-features=AutomationControlled" worked for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With