Locate an element with XPath
Easy30 pts~12 min
- Locators
- XPath
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 XPath expressions.
Your task
- 1Open TEST_URL.
- 2Locate the field with
//input[@placeholder='Search products']and type “tee”. - 3Locate the button with
//button[@id='search-button']and click it. - 4Assert
#search-summarycontains “tee”.
Acceptance criteria
- Elements are located with By.xpath
#search-summarymentions “tee”- At least 1 assertion passes
Selenium WebDriver 4 · Selenium · Locators & the DOM