[Solved] Python Run Selenium Error: NameError: name ‘By’ is not defined

NameError: name 'By' is not defined

Reason: the by class does not have a package, and the system cannot recognize the by object

Solution:

Import by package:

from selenium.webdriver.common.by import By

———————————-Warm tips—————————————

Automatic package guide shortcut: Alt + ENTER

Similar Posts: