Bird
0
0

Given the code below, what will be printed?

medium📝 Predict Output Q5 of 15
Selenium Python - Cross-Browser Testing
Given the code below, what will be printed?
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
print(driver.capabilities['goog:chromeOptions']['excludeSwitches'])
ANone
B[]
CKeyError exception
D['enable-logging']
Step-by-Step Solution
Solution:
  1. Step 1: Understand experimental options in ChromeOptions

    Adding 'excludeSwitches' with ['enable-logging'] sets this key in chromeOptions capabilities.
  2. Step 2: Access capabilities dictionary

    driver.capabilities['goog:chromeOptions']['excludeSwitches'] returns the list ['enable-logging'].
  3. Final Answer:

    ['enable-logging'] -> Option D
  4. Quick Check:

    Experimental option excludeSwitches = ['enable-logging'] [OK]
Quick Trick: Experimental options appear in capabilities under 'goog:chromeOptions' [OK]
Common Mistakes:
  • Expecting empty list by default
  • Assuming KeyError on missing keys
  • Confusing excludeSwitches with add_argument

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes