Find an element by ID
Easy30 pts~12 min
- Locators
- By.id
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
Locate the search field and button by their ids and run a search.
Your task
- 1Open TEST_URL.
- 2Find
search-inputby id and type “mug”. - 3Find
search-buttonby id and click it. - 4Assert
#search-summarycontains “mug”.
Acceptance criteria
- Elements are located with By.id
#search-summarymentions “mug”- At least 1 assertion passes
Selenium WebDriver 4 · Selenium · Locators & the DOM