Bird
0
0

Find the mistake in this FirefoxOptions usage:

medium📝 Debug Q7 of 15
Selenium Python - Cross-Browser Testing
Find the mistake in this FirefoxOptions usage:
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument('-headless')
driver = Firefox(options=options)
Aadd_argument() is not a valid method
BOptions object cannot be passed to Firefox
CArgument should be '--headless', not '-headless'
DHeadless mode must be set via options.headless attribute
Step-by-Step Solution
Solution:
  1. Step 1: Check argument syntax for headless mode

    The correct argument is '--headless' with two dashes.
  2. Step 2: Identify impact of wrong argument

    Using '-headless' will not enable headless mode as expected.
  3. Final Answer:

    Argument should be '--headless', not '-headless' -> Option C
  4. Quick Check:

    Headless argument requires double dashes [OK]
Quick Trick: Use '--headless' with two dashes for headless mode [OK]
Common Mistakes:
  • Using single dash '-headless'
  • Thinking add_argument() is invalid
  • Believing options cannot be passed to Firefox

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes