Selenium WebDriver 4

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.

Test URL
/lab/qa-automation-find-an-element-by-name

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

  1. 1Open TEST_URL.
  2. 2Find the field with name “q” and type “hoodie”.
  3. 3Click #search-button (or press Enter in the field).
  4. 4Assert the field value is “hoodie” and #search-summary contains “hoodie”.

Acceptance criteria

  • The field is located with By.name
  • #search-input holds “hoodie”
  • #search-summary mentions “hoodie”
  • At least 1 assertion passes

Selenium WebDriver 4 · QA Automation · Locators & the DOM