[英]LinkedIn automate "Sign in" click Python+Selenium
我正在嘗試使用 Python 和 Selenium 在 LinkedIn 中自動登錄。
到目前為止我被困在Sign in
按鈕上。 當我嘗試點擊它時
driver.find_element_by_xpath('//a[text()="Sign in"]').click()
我收到一個錯誤:
selenium.common.exceptions.ElementClickInterceptedException:消息:元素點擊被攔截:元素...在點 (1273, 80) 處不可點擊。 其他元素將收到點擊:...(會話信息:chrome=79.0.3945.130)
也試過driver.find_element_by_xpath('//*[contains(concat( " ", @class, " " ), concat( " ", "nav__button-secondary", " " ))]').click()
我生成通過使用適用於 Google Chrome 的SelectorGadget
擴展程序並得到與上述相同的錯誤...
至於我的 Chrome 版本是: Version 79.0.3945.130 (Official Build) (64-bit)
與我的 Windows 的 WebDriver 版本相同。
我今天使用 Python 3 和 Selenium 3.141.0 自動登錄(我不知道它會工作多久),並且我找到了一種使用find_element_by_class_name
和sign-in-form__submit-button
類名來做到這一點的方法:
def run(email, password):
#Open Chrome web
driver = webdriver.Chrome()
driver.get('https://www.linkedin.com/')
#Login username/password
email_box = driver.find_element_by_id('session_key')
email_box.send_keys(email)
pass_box = driver.find_element_by_id('session_password')
pass_box.send_keys(password)
submit_button = driver.find_element_by_class_name('sign-in-form__submit-button')
submit_button.click()
我在 MacOS 上使用 Chrome 版本 88.0.4324.96(官方版本)(x86_64)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.