Skip to content
CodeKruPro

The Selenium 4 way to find an element in Python

QuizEasyPython onlyAsked in: Accenture, Capgemini, TCS, Wipro

Which line finds the first element matching the CSS selector #login in Selenium 4.47 Python?

  • driver.find_element(By.CSS_SELECTOR, "#login")
  • driver.find_element_by_css_selector("#login")
  • driver.find_element("#login")
  • By.css("#login").find(driver)

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in