Hi Telerik Team,
Scenario to automate:
User creates few objects in application under test. The names of these objects could be anything which user specifies.
On some different page of the application I am having a HTML list box of type SELECT. This list gets populated with the object names which user have created previously. Here I want to select the multiple options from the list. I will be specifying the options to select as a comma separated list in the Excel column.
I have done it using a coded step. I would like to avoid the coded step. So I would like to know, if there is a way I can do it without coded step?
Code for the current coded step:
// Read the options from input Xls file and make a list from comma separted values
List<
string
> optionsToSelect = Data[
"ListOptions"
].ToString().Split(
new
char
[]{
','
},
StringSplitOptions.RemoveEmptyEntries).ToList<
string
>();
var lstBoxTestOptionsSelection = Pages.Page1.FrameFrame00.lstBoxAvailableOptions;
// Select the given options from the listbox
foreach
(
string
strOption
in
optionsToSelect)
{
foreach
(HtmlOption option
in
lstBoxTestOptionsSelection.Options)
{
if
(strOption.Equals(option.Text))
{
// Get the index of the option from listbox
Log.WriteLine(option.Text);
var indexToSelect = lstBoxTestOptionsSelection.Options.IndexOf(option);
Log.WriteLine(
"Index: "
+ indexToSelect);
// Select the option from listbox
lstBoxTestOptionsSelection.SelectByIndex(indexToSelect);
// There is another list to which I need to add the selected items so clicking on Add button.
// Click on Add button to the other list box where we are kepping the selected items
Pages.Page1.FrameFrame00.BtnAddRSDiv.Click();
break
;
}
}
lstBoxTestOptionsSelection = Pages.Page1.FrameFrame00.lstAvailableRSSelect;
}