title: Proper syntax for find_element in Selenium Python
body: <p>I am attempting to build a web scraper in Selenium. The first thing I want the script to do is to log in with my credentials into a database. Thus, I attempted to use find_element in order locate the user id/password entry fields.</p>
  <p>However, when I used find_element, I was thrown the following error: &quot;By&quot; is not defined Pylance (reportUndefinedVariable).</p>
  <p>I've read the Selenium 4 documentation at selenium.dev, but I'm not sure what exactly has gone wrong here.</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.chrome.service import Service as ChromeService
  from selenium.webdriver.edge.service import Service as EdgeService
  from selenium.webdriver.firefox.service import Service as FirefoxService
  from selenium.webdriver.ie.service import Service as IEService
  from webdriver_manager.chrome import ChromeDriverManager
  from webdriver_manager.firefox import GeckoDriverManager
  from webdriver_manager.microsoft import EdgeChromiumDriverManager
  from webdriver_manager.microsoft import IEDriverManager
  
  
  def test_driver_manager_chrome():
      service = ChromeService(executable_path=ChromeDriverManager().install())
  
      driver = webdriver.Chrome(service=service)
  
      driver.quit()
  
  #open the browser
  
  driver = webdriver.Chrome()
  driver.implicitly_wait(30)
  driver.maximize_window
  
  #navigate to the website
  
  driver.get(&quot;URL&quot;)
  
  #log in 
  
  userID = driver.find_element(By.ID, &quot;_58_login&quot;)
  
  </code></pre>