【问题标题】:Unable to locate element: Gmail email ID无法找到元素:Gmail 电子邮件 ID
【发布时间】:2020-02-27 17:21:37
【问题描述】:

试图找到 gmail 用户名的 ID 以发送密钥。使用下面的代码时,python一直返回找不到元素。

chrome.find_element_by_xpath("//*[@id='identifierId']")

HTML 是:

<input type="email" class="whsOnd zHQkBf" jsname="YPqjbf" autocomplete="username" spellcheck="false" tabindex="0" aria-label="Email or phone" name="identifier" value="" autocapitalize="none" id="identifierId" dir="ltr" data-initial-dir="ltr" data-initial-value="">

请帮忙

【问题讨论】:

    标签: python selenium-webdriver gmail


    【解决方案1】:

    最近我用它来自动登录 gmail:

    username = chrome.find_element_by_css_selector(
            "input[placeholder='Username']")
    password = chrome.find_element_by_css_selector(
            "input[placeholder='Password']")
    login_button = chrome.find_element_by_css_selector(
            "button.src-components-Login-LoginPanel-LoginForm-index__submit--2fvkB ")
    username.send_keys(user)
    password.send_keys(pwd)
    login_button.click()
    

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2021-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-23
      • 1970-01-01
      • 1970-01-01
      • 2017-11-16
      • 2012-09-21
      相关资源
      最近更新 更多