Bird
0
0

Consider this code snippet:

medium📝 Predict Output Q5 of 15
Selenium Python - Selenium Grid
Consider this code snippet:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

remote_url = 'http://localhost:4444/wd/hub'
driver = webdriver.Remote(command_executor=remote_url, desired_capabilities=DesiredCapabilities.FIREFOX)
print(driver.session_id)
driver.quit()
What will happen if no Firefox node is registered to the Grid?
ASessionNotCreatedException error
BPrints a valid session ID
CPrints None
DTimeout and then prints session ID
Step-by-Step Solution
Solution:
  1. Step 1: Understand node availability impact

    If no Firefox node is available, Grid cannot create a session for Firefox.
  2. Step 2: Identify error raised

    Selenium raises SessionNotCreatedException when requested browser node is missing.
  3. Final Answer:

    SessionNotCreatedException error -> Option A
  4. Quick Check:

    No node for browser = SessionNotCreatedException [OK]
Quick Trick: No matching node causes SessionNotCreatedException [OK]
Common Mistakes:
  • Expecting session ID even if node missing
  • Assuming None is returned
  • Thinking timeout prints session ID

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes