Bird
0
0

What will be the output of the following code snippet?

medium📝 Predict Output Q4 of 15
Selenium Python - Cross-Browser Testing
What will be the output of the following code snippet?
from selenium import webdriver
options = webdriver.FirefoxOptions()
options.add_argument('--private')
driver = webdriver.Firefox(options=options)
print(driver.capabilities['moz:firefoxOptions']['args'])
A['--private']
B['--headless']
C[]
DKeyError exception
Step-by-Step Solution
Solution:
  1. Step 1: Understand FirefoxOptions argument addition

    Adding '--private' argument to FirefoxOptions stores it in the args list inside capabilities.
  2. Step 2: Access capabilities dictionary

    driver.capabilities['moz:firefoxOptions']['args'] returns the list of arguments passed, which includes '--private'.
  3. Final Answer:

    ['--private'] -> Option A
  4. Quick Check:

    FirefoxOptions args list = ['--private'] [OK]
Quick Trick: Options args appear in capabilities under 'moz:firefoxOptions' [OK]
Common Mistakes:
  • Expecting headless by default
  • Assuming args list is empty
  • Thinking accessing keys causes error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes