Write an attribute-based CSS selector
Medium70 pts~25 min
- CSS selectors
- Attributes
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
Target elements purely by attributes such as placeholder, data-testid and aria-label.
Your task
- 1Open TEST_URL.
- 2Type “hoodie” into
[placeholder='Search products']and click#search-button. - 3Assert
#search-summarycontains “hoodie”. - 4Locate
[data-testid='checkout']and assert its aria-label is “Proceed to checkout”.
Acceptance criteria
- Attribute selectors are used with By.cssSelector
#search-summarymentions “hoodie”- At least 2 assertions pass
Selenium WebDriver 4 · Selenium · Locators & the DOM