您好,我試圖點擊網站上的男性按鈕:
此外,與 硒4 以下行:
webdriver.Chrome(executable_path="D:\ChromeDriverExtracted\chromedriver")
現在與 a 相關聯,DeprecationWarning如下所示:
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
所以你需要傳遞一個Service類的實體作為引數,你的有效代碼塊將是:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
s = Service('D:\ChromeDriverExtracted\chromedriver.exe')
driver = webdriver.Chrome(service=s)
driver.get("https://fs2.formsite.com/meherpavan/form2/index.html?1537702596407")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//label[@for='RESULT_RadioButton-7_0']"))).click()
參考
您可以在以下位置找到一些相關的詳細討論:
- init () 接受 2 個位置引數,但使用 WebDriverWait 和 expected_conditions 作為 element_to_be_clickable 使用 Selenium Python 給出 3 個位置引數
- 將 Selenium 與用 Python 撰寫的 Brave Browser 傳遞服務物件一起使用
uj5u.com熱心網友回復:
這是一個你應該傳遞的元組,
EC.element_to_be_clickable((By.XPATH, "//type[@name='RESULT_RadioButton-7_0']")))
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/362067.html
標籤:Python 硒 硒网络驱动程序 网络驱动程序等待 预期条件
