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
from selenium.webdriver.edge.options import Options
options = Options()
options.add_argument('--headless')
driver = webdriver.Edge(options=options)
print(driver.capabilities['ms:edgeOptions']['args'])
ANone
B[]
C['--headless']
DError: 'args' key not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand what add_argument('--headless') does

    This adds the '--headless' flag to the EdgeOptions arguments list.
  2. Step 2: Access the 'args' key in capabilities

    The 'args' key under 'ms:edgeOptions' contains the list of arguments passed, so it will include '--headless'.
  3. Final Answer:

    ['--headless'] -> Option C
  4. Quick Check:

    Arguments list = ['--headless'] [OK]
Quick Trick: Check capabilities['ms:edgeOptions']['args'] for passed arguments [OK]
Common Mistakes:
  • Expecting empty list if headless not set
  • Assuming 'args' key is missing
  • Confusing capabilities structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes