selenium Error

Selenium Error: find_element_by_* commands are deprecated

When using Selenium with Python, you may encounter the "find_element_by_* commands are deprecated" error. This article introduces the cause and countermeasures for this error.

Shou Arisaka
1 min read
Oct 3, 2025

When using Selenium with Python, you may encounter the “find_element_by_* commands are deprecated” error. This article introduces the cause and countermeasures for this error.

Image

DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead

The above error means that in the latest Selenium Python library, the use of find_element_by_* commands is deprecated.

As a countermeasure, for example, you can use the following instead.

find_element()

Use By.CLASS_NAME and similar.

from selenium.webdriver.common.by import By

# .. 

# Use this
driver.find_element(By.CLASS_NAME, "hogehoge")

# Don't use this
driver.find_element_by_class_name("hogehoge")

Reference:

python - find_element_by_* commands are deprecated in selenium - Stack Overflow

Share this article

Shou Arisaka Oct 3, 2025

🔗 Copy Links