Bird
0
0

Given the following Selenium Grid setup code snippet, what will be the output when the test runs?

medium📝 Predict Output Q13 of 15
Selenium Python - Selenium Grid
Given the following Selenium Grid setup code snippet, what will be the output when the test runs?
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

hub_url = "http://localhost:4444/wd/hub"
driver = webdriver.Remote(command_executor=hub_url, desired_capabilities=DesiredCapabilities.CHROME)
print(driver.capabilities['browserName'])
driver.quit()
Asafari
Bfirefox
Cedge
Dchrome
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the desired capabilities used

    The code requests a Chrome browser by using DesiredCapabilities.CHROME.
  2. Step 2: Understand the output of driver.capabilities['browserName']

    This returns the name of the browser the remote driver is connected to, which should be 'chrome'.
  3. Final Answer:

    chrome -> Option D
  4. Quick Check:

    DesiredCapabilities.CHROME = 'chrome' output [OK]
Quick Trick: DesiredCapabilities.CHROME means browserName is 'chrome' [OK]
Common Mistakes:
  • Assuming default browser is Firefox
  • Confusing capability keys
  • Not quitting driver causing errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes