Bird
0
0

Given this Python code connecting to a Docker Selenium Grid, what will print(driver.capabilities['browserName']) output?

medium📝 Predict Output Q4 of 15
Selenium Python - Selenium Grid
Given this Python code connecting to a Docker Selenium Grid, what will print(driver.capabilities['browserName']) output?
from selenium import webdriver
options = webdriver.FirefoxOptions()
driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub', options=options)
print(driver.capabilities['browserName'])
Achrome
Bfirefox
Csafari
Dedge
Step-by-Step Solution
Solution:
  1. Step 1: Identify browser options used

    The code uses FirefoxOptions(), so the browser requested is Firefox.
  2. Step 2: Understand capabilities output

    driver.capabilities['browserName'] returns the browser name of the session, which matches Firefox.
  3. Final Answer:

    firefox -> Option B
  4. Quick Check:

    Browser options = Firefox => browserName = B [OK]
Quick Trick: Browser name matches options used in Remote WebDriver [OK]
Common Mistakes:
  • Assuming default browser is Chrome
  • Confusing options object with browser name
  • Expecting browserName to be capitalized

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes