Which of the following reasons best explains why Selenium is considered the standard tool for web automation?
Think about what makes a tool useful for many different teams and projects.
Selenium supports many browsers like Chrome, Firefox, and Edge, and works with languages like Python, Java, and JavaScript. This flexibility makes it popular.
What will be the output of the following Selenium Python code when run?
from selenium import webdriver from selenium.webdriver.common.by import By options = webdriver.ChromeOptions() options.add_argument('--headless') driver = webdriver.Chrome(options=options) driver.get('https://example.com') title = driver.title driver.quit() print(title)
Consider what the title of https://example.com is.
The page https://example.com has the title 'Example Domain'. The code fetches and prints this title.
Given a web page where the element's ID changes every time the page loads, which locator strategy is best to reliably find the element?
Think about how to find elements when IDs are not stable.
When IDs change dynamically, using XPath with a stable parent and relative path helps locate the element reliably.
Which assertion correctly verifies that the page title is exactly 'Login Page' in a Selenium Python test?
from selenium import webdriver # Assume driver is already initialized and page loaded page_title = driver.title
Check for exact match of the title string.
Using 'assert page_title == "Login Page"' ensures the title matches exactly.
You want to run Selenium tests in parallel to speed up execution. Which Python test framework supports this feature natively and integrates well with Selenium?
Look for a framework that supports parallel test runs easily.
pytest with the pytest-xdist plugin allows running tests in parallel and works well with Selenium tests.