Bird
0
0

You want to configure Edge to run in headless mode, disable extensions, and set a custom user agent. Which code snippet correctly applies all these options?

hard📝 Application Q8 of 15
Selenium Python - Cross-Browser Testing
You want to configure Edge to run in headless mode, disable extensions, and set a custom user agent. Which code snippet correctly applies all these options?
Aoptions = webdriver.EdgeOptions() options.add_argument('--headless') options.add_argument('--disable-extensions') options.add_argument('user-agent=CustomAgent') driver = webdriver.Edge(options=options)
Boptions = webdriver.EdgeOptions() options.add_argument('headless') options.add_argument('disable-extensions') options.add_argument('--user-agent=CustomAgent') driver = webdriver.Edge(options=options)
Coptions = webdriver.EdgeOptions() options.add_argument('--headless') options.add_argument('--disable-extensions') options.add_argument('--user-agent=CustomAgent') driver = webdriver.Edge(options=options)
Doptions = webdriver.EdgeOptions() options.add_argument('--headless') options.add_argument('--disable-extensions') options.set_user_agent('CustomAgent') driver = webdriver.Edge(options=options)
Step-by-Step Solution
Solution:
  1. Step 1: Verify correct argument format

    All arguments must start with '--' including user-agent which requires '--user-agent=' prefix.
  2. Step 2: Check each option usage

    Options A misses dashes for user-agent, C misses dashes for headless and disable-extensions, D uses non-existent set_user_agent method.
  3. Final Answer:

    Options with all arguments correctly prefixed with '--' -> Option C
  4. Quick Check:

    All flags need '--' prefix including user-agent [OK]
Quick Trick: Prefix all flags with '--', user-agent included [OK]
Common Mistakes:
  • Omitting dashes on some arguments
  • Using non-existent methods like set_user_agent
  • Passing user-agent without '--user-agent='

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes