簡體   English   中英

問題 "driver.find_element_by_xpath("//div[@class='example']"

[英]Problem " driver.find_element_by_xpath("//div[@class='example']"

我已經遇到這個問題幾天了。 我使用 Pycharm 和 Python:

UserWarning: find_element_by_* commands are deprecated. Please use find_element() instead
warnings.warn("find_element_by_* commands are deprecated. Please use find_element() instead")

問候

嘗試以下...

首先導入By如下: from selenium.webdriver.common.by import By

然后,例如,如果您嘗試通過 xpath 查找元素,請替換:

find_elements_by_xpath("[***whatever the xpath is***]")

和:

driver.find_element(By.XPATH, "[***whatever the xpath is***]")

有關調用元素的各種方法的示例,請參閱 使用 Python 的 Selenium 參考網站

暫無
暫無

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

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