Skip to main content Skip to docs navigation

Select Option

These commands are specific to dropdown

On this page

<select id="product-size">

  <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>

Example

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