Use relative (friendly) locators
Medium70 pts~25 min
- Relative locators
- Selenium 4
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 button by its position relative to the search field.
Your task
- 1Open TEST_URL and type “cap” into
#search-input. - 2Locate the
buttonthat is to the right of#search-inputwith a relative locator. - 3Click it and assert
#search-summarycontains “cap”.
Acceptance criteria
- A relative locator is used
#search-summarymentions “cap”- At least 1 assertion passes
Selenium WebDriver 4 · Selenium · Locators & the DOM