Bird
0
0

Identify the error in this Selenium Python code snippet meant for cross-browser testing:

medium📝 Debug Q14 of 15
Selenium Python - Cross-Browser Testing
Identify the error in this Selenium Python code snippet meant for cross-browser testing:
from selenium import webdriver

driver = webdriver.Chrome
driver.get('https://example.com')
driver.quit()
AIncorrect URL format
BIndentation error on driver.get line
Cdriver.quit() is missing
DMissing parentheses after webdriver.Chrome
Step-by-Step Solution
Solution:
  1. Step 1: Check driver initialization

    The code uses webdriver.Chrome without parentheses, so it does not create a driver instance.
  2. Step 2: Check other lines

    URL format is correct, driver.quit() is present.
  3. Step 3: Identify the main error

    Missing parentheses cause a TypeError because webdriver.Chrome is a class, not an instance.
  4. Final Answer:

    Missing parentheses after webdriver.Chrome -> Option D
  5. Quick Check:

    webdriver.Chrome() needs parentheses [OK]
Quick Trick: Always add () to create WebDriver instance [OK]
Common Mistakes:
  • Forgetting parentheses after driver class
  • Ignoring indentation errors
  • Assuming quit() is missing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes