尝试通过 Selenium 和 Python 使用 GeckoDriver Firefox 登录 Gmail 帐户时出现“此浏览器或应用程序可能不安全"错误 [英] “This browser or app may not be secure” error while attempting to login in to Gmail account using GeckoDriver Firefox through Selenium and Python

查看:52
本文介绍了尝试通过 Selenium 和 Python 使用 GeckoDriver Firefox 登录 Gmail 帐户时出现“此浏览器或应用程序可能不安全"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 selenium 登录我的 gmail 帐户.我使用 python2.7 .它没有错误,但是页面说由于某种原因我无法登录我的帐户.你可以看到下面的截图.

I want to login to my gmail account using selenium. I use python2.7 . It doesn't have error, but the page said that I couldn't sign in to my account because some reason. you can see the screenshot below.

这是我的代码:

import time
import selenium
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

EXE_PATH = r'C:UsersLENOVODownloadsgeckodriver.exe'
driver = webdriver.Firefox(executable_path=EXE_PATH)

def login():
    mail = 'myMail'
    pw = 'myPassword'
    driver.get('https://gmail.com')
    email = driver.find_element_by_name('identifier')
    email.send_keys(mail)
    driver.find_element_by_id('identifierNext').click()
    time.sleep(10)
    password = driver.find_element_by_name('password')
    password.send_keys(pw)
    driver.find_element_by_id('passwordNext').click()

我该怎么办?请帮助我,我只是一个菜鸟和初学者.谢谢楼主

what have to I do? please help me, I just a noob and beginner. thanks master

推荐答案

试试这个对我有用的解决方案 我现在什至可以用这个解决方案登录我的 Gmail.在设置了用户代理属性之后,它就像一个奇迹一样工作.

Try this solution it worked for me I can even log in my Gmail now with this solution. after setting up the user-agent attribute it worked like a miracle.

<webview src="https://mail.google.com/" useragent="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko"></webview>

这篇关于尝试通过 Selenium 和 Python 使用 GeckoDriver Firefox 登录 Gmail 帐户时出现“此浏览器或应用程序可能不安全"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆