Bird
0
0

What will be the output of the following Selenium Python code snippet when run on a CI server?

medium📝 Predict Output Q13 of 15
Selenium Python - CI/CD Integration
What will be the output of the following Selenium Python code snippet when run on a CI server?
from selenium import webdriver
options = webdriver.FirefoxOptions()
options.add_argument('--headless')
driver = webdriver.Firefox(options=options)
driver.get('https://example.com')
title = driver.title
driver.quit()
print(title)
APrints the page title 'Example Domain' without opening a browser window
BRaises an error because Firefox does not support headless mode
CPrints an empty string because headless mode disables page loading
DOpens a visible browser window and prints the title
Step-by-Step Solution
Solution:
  1. Step 1: Understand Firefox headless support

    Firefox supports headless mode via options.add_argument('--headless'), so the browser runs without UI.
  2. Step 2: Analyze code behavior

    The code loads 'https://example.com', gets the page title 'Example Domain', then quits the driver and prints the title.
  3. Final Answer:

    Prints the page title 'Example Domain' without opening a browser window -> Option A
  4. Quick Check:

    Headless Firefox loads page and returns title correctly [OK]
Quick Trick: Headless mode loads pages normally but hides browser window [OK]
Common Mistakes:
  • Assuming headless disables page loading
  • Thinking Firefox lacks headless support
  • Expecting visible browser window in headless mode

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes