Locate an element with a CSS selector
Easy30 pts~12 min
- Locators
- CSS selectors
Practice app · Practice Catalog
A product catalog with ids, names, classes, links, data-testids and duplicate buttons for locator practice.
Your starter code already declares TEST_URL — never hardcode a host.
Objective
Drive the search with CSS selectors instead of the id/name shortcuts.
Your task
- 1Open TEST_URL.
- 2Locate the field with the CSS selector
input.search-fieldand type “selenium”. - 3Locate the button with
button[type='submit']and click it. - 4Assert
#search-summarycontains “selenium”.
Acceptance criteria
- Elements are located with By.cssSelector
#search-summarymentions “selenium”- At least 1 assertion passes
Selenium WebDriver 4 · QA Automation · Locators & the DOM