Bird
0
0

Identify the error in this code snippet:

medium📝 Debug Q6 of 15
Selenium Python - Cross-Browser Testing
Identify the error in this code snippet:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--disable-extensions')
driver = webdriver.Chrome(option=options)
Awebdriver.ChromeOptions() is not valid
BIncorrect parameter name 'option' instead of 'options' in Chrome()
Cadd_argument() does not accept '--disable-extensions'
DMissing import for Chrome
Step-by-Step Solution
Solution:
  1. Step 1: Check parameter name in Chrome constructor

    The correct parameter name is 'options', not 'option'. Passing 'option' causes a TypeError.
  2. Step 2: Validate other parts

    add_argument('--disable-extensions') is valid, ChromeOptions is valid, and import is correct.
  3. Final Answer:

    Incorrect parameter name 'option' instead of 'options' in Chrome() -> Option B
  4. Quick Check:

    Pass options=options, not option=options [OK]
Quick Trick: Use options=options when creating driver [OK]
Common Mistakes:
  • Using 'option' instead of 'options'
  • Thinking add_argument rejects valid flags
  • Assuming ChromeOptions is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes