簡體   English   中英

兩個問題,executable_path has been deprecated,請傳入一個Service object problem and 'list' object has no attribute 'text'

[英]Two questions, executable_path has been deprecated, please pass in a Service object problem and 'list' object has no attribute 'text'

.pip 安裝 selenium.pip 從 selenium 安裝 chromedriver 從 selenium.webdriver.common.by 導入

browser = webdriver.Chrome('path')
browser.get('url')
elem_h2 = browser.find_elements(By.CLASS_NAME,'class_name')
elem_h2.text()

這是我已經寫的,錯誤是說 [executable_path 已被棄用,請傳入服務對象],['list' object 沒有屬性 'text']

如果歡迎您提出我的問題,我將不勝感激。

嘗試這個:

from selenium.webdriver.chrome.service import Service
from selenium import webdriver

service = Service('path')
browser = webdriver.Chrome(service=service)
browser.get('url')
elem_h2 = browser.find_elements(By.CLASS_NAME,'class_name')
elem_h2.text()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM