Find an element by name
Easy30 pts~12 min
- Locators
- By.name
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 by its name attribute and search for a product.
Your task
- 1Open TEST_URL.
- 2Find the field with name “q” and type “hoodie”.
- 3Click
#search-button(or press Enter in the field). - 4Assert the field value is “hoodie” and
#search-summarycontains “hoodie”.
Acceptance criteria
- The field is located with By.name
#search-inputholds “hoodie”#search-summarymentions “hoodie”- At least 1 assertion passes
Selenium WebDriver 4 · Selenium · Locators & the DOM