w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to Select Multiple values from a Multiple select List Box in Coded UI Test

Lets say your multiselect listbox control is MyListBox, which you have already capture or searched.

Multiselect HTML

<select multiple>
  <option value="item1">Apple</option>
  <option value="item2">Orange</option>
  <option value="item3">Banana</option>
  <option value="item4">Grapes</option>

This is how you select multiple item:

var items = new string[] { "item1", "item4" }
MyListBox.SelectedItems = items;


var items = new int[] { 0, 3 }
MyListBox.SelectedIndices= items;

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.