簡體   English   中英

在 python 中使用 selenium 時的警告

[英]Warning while using selenium with python

使用 selenium 在 html 中查找標簽或類時,我收到以下警告:

<ipython-input-6-f7f8e8a9bbfc>:32: DeprecationWarning: find_elements_by_* commands are deprecated. Please use find_elements() instead
  divTag = driver.find_elements_by_class_name('quote')

但是 find_elements() 也不起作用:

InvalidArgumentException: Message: invalid argument: invalid locator
  (Session info: chrome=95.0.4638.69)
Stacktrace:
Backtrace:

有人可以幫我刪除警告嗎?

代替

divTag = driver.find_elements_by_class_name('quote')

嘗試使用

divTag = driver.find_elements(By.CLASS_NAME,'quote')

暫無
暫無

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

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