0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Selenium】バージョン更新後のWarningについて

Posted at

seleniumのバージョンによりfind_element_by_xpathなどで要素検索すると以下ようなWarningメッセージが出ます。

<stdin>:1: DeprecationWarning: find_element_by_tag_name is deprecated. Please use find_element(by=By.TAG_NAME, value=name) instead

翻訳にすると以下のようなメッセージです。

<stdin>:1: DeprecationWarning: find_element_by_tag_name は非推奨です。代わりに find_element(by=By.TAG_NAME, value=name)を使って下さい。

また、以下のバージョンの場合に発生します。

$ pip list | grep selenium
selenium              4.1.3

どうやらfind_element_by_XXはfind_element(By.XX)に変わったようです。

今のところはWarningメッセージが出るだけで処理自体で実行できますが、非推奨ということですので、find_element(By.XX)に変更する方が良いでしょう。

また、deprecatedという単語は本件のみではなくいろんなところで見かける単語になりますので、何かのlogにこの単語がある場合非推奨なんだなぁってわかるようにしておくことは必要かと思います。

クイックリファレンス

私は基本的にSeleniumで何かしたい場合は以下クリックリファレンスを参考します。
こちらにいつの間にか更新されておりましたので、
以下リンクを参考するのが良いかと思いますので、ぜひブックマークとかに登録しましょう

Selenium API(逆引き)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?