Bird
0
0

Which of the following is the correct way to run Chrome in headless mode in Selenium Python?

easy📝 Syntax Q12 of 15
Selenium Python - CI/CD Integration
Which of the following is the correct way to run Chrome in headless mode in Selenium Python?
Aoptions.add_argument('--headless')
Boptions.set_headless(True)
Cdriver.headless = True
Ddriver.set_option('headless')
Step-by-Step Solution
Solution:
  1. Step 1: Recall Selenium ChromeOptions usage

    To run Chrome headless, add the argument '--headless' to options.
  2. Step 2: Verify correct syntax

    Using options.add_argument('--headless') is the correct method in Selenium Python.
  3. Final Answer:

    options.add_argument('--headless') -> Option A
  4. Quick Check:

    Headless Chrome = add_argument('--headless') [OK]
Quick Trick: Use add_argument('--headless') to enable headless mode [OK]
Common Mistakes:
  • Using non-existent methods like set_headless
  • Trying to set driver.headless directly
  • Confusing driver and options methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes