Home > Enterprise >  Problem to login Gmail account with Selenium Python
Problem to login Gmail account with Selenium Python

Time:11-11

I'm writing a Python code using Selenium to optimize tasks on Google Sites.

For this to be possible, you need to log into your Gmail account.

I can't log into the account because Google doesn't recognize the valid browser.

Any solution to this problem?

enter image description here

CodePudding user response:

You can bypass bot detection with SeleniumBase in uc mode.

First pip install seleniumbase. Then you can run:

from seleniumbase import SB

with SB(uc=True) as sb:
    sb.open("https://www.google.com/gmail/about/")
    sb.click('a[data-action="sign in"]')
    sb.type('input[type="email"]', "[email protected]")
    sb.click('button:contains("Next")')
    sb.sleep(5)
    # sb.type('input[type="password"]', PASSWORD)
    # sb.click('button:contains("Next")')

Update the script with the info you need, then run with python. To access the raw driver from the script, use sb.driver.

  • Related