Bird
0
0

What will be the output of the following code snippet?

medium📝 Predict Output Q13 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.service import Service
from selenium.webdriver.edge.options import Options

options = Options()
options.add_argument('--window-size=800,600')
service = Service('path/to/msedgedriver')
driver = webdriver.Edge(service=service, options=options)
print(driver.execute_script('return window.innerWidth + "," + window.innerHeight'))
driver.quit()
A"800,600"
B"1024,768"
CSyntaxError
DRuntimeError
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the options argument

    The code sets the window size to 800x600 using --window-size=800,600.
  2. Step 2: Understand the JavaScript execution

    The script returns the current window inner width and height as a string separated by a comma.
  3. Final Answer:

    "800,600" -> Option A
  4. Quick Check:

    Window size set to 800x600, script returns "800,600" = C [OK]
Quick Trick: Window size argument sets innerWidth and innerHeight [OK]
Common Mistakes:
  • Assuming default window size is returned
  • Confusing Service() with Options()
  • Expecting syntax or runtime errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes