Skip to main content Skip to docs navigation

Select Option

These commands are specific to dropdown

On this page
html

<div class="p-3">
<select id="product-size" class="form-select">
  <option>size</option>
  <option data-value-class="opt-35item-0" data-value-size="35" value="opt-35item-0">
    35
  </option>
  <option data-value-class="opt-36item-1" data-value-size="36" value="opt-36item-1">
    36
  </option>
  <option data-value-class="opt-37item-2" data-value-size="37" value="opt-37item-2">
    37
  </option>
  <option data-value-class="opt-38item-3" data-value-size="38" value="opt-38item-3">
    38
  </option>
  <option data-value-class="opt-39item-4" data-value-size="39" value="opt-39item-4">
    39
  </option>
  <option data-value-class="opt-40item-5" data-value-size="40" value="opt-40item-5">
    40
  </option>
</select></div>
Action
Element Finder Value

Example

Element FinderSelection
//select[@id="product-size"]/option[2]Selects the second option with text 35.
//select[@id="product-size"]/option[@data-value-size="36"]Selects the option with data-value-size 36.
//select[@id="product-size"]/option[contains(@value,"opt-40")]Selects the option whose value contains opt-40.
//select[@id="product-size"]/option[text()="39"]Selects the option with text 39.
You must set the value field to true