I am getting an error in app automation. Can you please help me?

Since driver.find_element_by has been deprecated, I am changing my code from driver.find_element_by_class_name("LOCATOR") to driver.find_element(By.CLASS_NAME, "quiz_button")

But now, I am getting this error:

NameError: name 'By' is not defined.

I need some help.

Hello Ian,

As mentioned in the error statement, By is not identifiable.

You can try to add the following import statement:

from selenium.webdriver.common.by import By