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:
- Error reporting in Firefox using selenium in Python
- Under Ubuntu system, selenium opens the Firefox browser and prompts’ unable to find a matching set of capabilities. And message: connect
- Mac environment and python + selenium environment are built to solve the error reporting problem of chromedriver
- Message: ‘geckodriver’ executable needs to be in PATH. [Solved]
- Selenium Error: Message: unknown error: cannot find Chrome binary
- Solve the problem of import error: cannot import name webriver
- selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
- [Solved] Selenium Error: ElementClickInterceptedException
- How to Solve centos7 selenium–unknown error: DevToolsActivePort file doesn’t exist
- Error when uirecorder starts webdriver service