Bird
0
0

Given this Python code connecting to Selenium Grid:

medium📝 Predict Output Q13 of 15
Selenium Python - Selenium Grid
Given this Python code connecting to Selenium Grid:
from selenium import webdriver
caps = {'browserName': 'firefox'}
driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub', desired_capabilities=caps)
driver.get('https://example.com')
print(driver.title)
What will be printed if the Grid and node are correctly set up?
AEmpty string
BAn error about missing local browser
CThe title of the page at https://example.com
DSyntaxError
Step-by-Step Solution
Solution:
  1. Step 1: Understand code execution with Grid

    The code uses Remote WebDriver to open Firefox on Grid node and navigates to example.com.
  2. Step 2: Predict output of print(driver.title)

    If Grid and node are correct, driver.title returns the page title of example.com, which is a string like 'Example Domain'.
  3. Final Answer:

    The title of the page at https://example.com -> Option C
  4. Quick Check:

    Remote driver prints page title when setup is correct [OK]
Quick Trick: Correct Grid setup means driver.title shows page title [OK]
Common Mistakes:
  • Expecting local browser errors when Grid is correct
  • Thinking driver.title returns empty string by default
  • Confusing syntax errors with runtime behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes