Selenium WebDriver 4

Select an option by value and index

Medium70 pts~25 min
  • Select
  • Dropdowns
Practice app · Workshop Registration

A registration form with text fields, radios, checkboxes, selects and validation.

Test URL
/lab/selenium-select-an-option-by-value-and-index

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Select options by their value attribute and by their position.

Your task

  1. 1Open TEST_URL and wrap #country in the Select helper.
  2. 2Select by value “gb” and assert the selected text is “United Kingdom”.
  3. 3Select by index 3 and assert the selected text is “Germany”.

Acceptance criteria

  • selectByValue is used
  • selectByIndex is used
  • #country value is “de”
  • At least 2 assertions pass

Selenium WebDriver 4 · Selenium · Forms & inputs