Bird
0
0

In Selenium Python, which property is used to retrieve the current browser's name for applying browser-specific logic?

easy📝 Conceptual Q2 of 15
Selenium Python - Cross-Browser Testing
In Selenium Python, which property is used to retrieve the current browser's name for applying browser-specific logic?
Adriver.get_browser_name()
Bdriver.capabilities['browserName']
Cdriver.browserName
Ddriver.get_capability('browser')
Step-by-Step Solution
Solution:
  1. Step 1: Check Selenium WebDriver capabilities

    The 'capabilities' dictionary contains browser details.
  2. Step 2: Access browser name correctly

    Use driver.capabilities['browserName'] to get the browser name string.
  3. Final Answer:

    driver.capabilities['browserName'] -> Option B
  4. Quick Check:

    Use capabilities dictionary [OK]
Quick Trick: Use driver.capabilities['browserName'] [OK]
Common Mistakes:
  • Using incorrect attribute names like 'browsername' (case-sensitive)
  • Calling non-existent methods like get_browser_name()
  • Accessing driver.browserName directly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes