亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

chromedriver selenium.common.exceptions.

chromedriver selenium.common.exceptions.

吃雞游戲 2024-01-27 16:28:24
我一直在努力解決 find_element_by_class_name 問題。我正在嘗試使用 selenium 和 chromedriver 登錄網頁。為此,我必須首先找到登錄按鈕并單擊它。不幸的是,當我使用 find_element_by_class_name 或 find_element_by_xpath 方法時,我收到以下錯誤消息:selenium.common.exceptions.NoSuchElementException:消息:沒有這樣的元素:無法定位元素我使用的是硒版本 3.141.0鉻版本 86.0.4240.75蟒蛇3這是我的代碼:import osfrom selenium import webdriverfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWait# Load driver (for Google Chrome)  chromedriver = "/usr/local/bin/chromedriver"os.environ["webdriver.chrome.driver"] = chromedriverdriver = webdriver.Chrome(chromedriver)url = "https://bib.cnrs.fr/#"driver.get(url)# Authentificationdriver.implicitly_wait(10)connexion = driver.find_element_by_class_name("login-button.btn.btn-link").click()我嘗試按照此處的建議等待頁面加載:selenium.common.exceptions.NoSuchElementException:消息:沒有這樣的元素:無法定位元素:我應該做什么和selenium.common.exceptions.NoSuchElementException:消息:無法定位元素:我還嘗試過使用此處建議的 xpath 方法:Troublefindingelement in Selenium with Python但無濟于事。盡管 html 源代碼中存在“login-button.btn.btn-linky”類,但該函數似乎找不到它。任何幫助將不勝感激。
查看完整描述

1 回答

?
滄海一幻覺

TA貢獻1824條經驗 獲得超5個贊

問題是我有 2 個版本的 chromedriver,第一個對應于我擁有的早期版本的 chrome,第二個對應于我的新 chrome 版本 86.0.4240.75

看來硒默認調用舊版本??梢詮慕K端輸出的錯誤信息中查看正在使用的chromedriver版本。

我卸載了 chromedriver(兩個版本),并通過在此處獲取正確的軟件包(與我的 google-chrome 對應的軟件包)重新安裝了正確的版本: https: //chromedriver.chromium.org/downloads


查看完整回答
反對 回復 2024-01-27
  • 1 回答
  • 0 關注
  • 157 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號