Selecting multiple values from a option list
Posted: Thu Sep 13, 2018 3:16 pm
Hello,
I'm working in a scenario where i'm suppose to select three option list values from the option list.
I'm using the below code to select but it doesn't seem to be working.
WebDocument webdoc = new WebDocument("/dom[@domain='10.158.118.16:28443']");
SelectTag someSelectTag =webdoc.FindSingle(".//div/fieldset/div//table//tr/td/div//select[@class='v-select-select']");
IList<OptionTag> optTag = someSelectTag.Find<OptionTag>(".//option");
IList<String> p_Name = new List<String>{"ranorex queue 1fi","ranorex queue 2fi","ranorex queue 3fi"};
int c=0;
for(int i=0; i<p_Name.Count;i++)
{
for(int k=0; k<optTag.Count; k++)
{
if(optTag[k].InnerText.Contains(p_Name))
{
Delay.Seconds(1);
optTag[k].Selected=true;
Report.Log(ReportLevel.Success,optTag[k].InnerText + " " + "Queue name has been successfully removed from the update users at Queue list ");
c=1;
}
}
if(c==0){
Report.Log(ReportLevel.Failure,"Unable to remove from update users at Queue list");
}
}
I'm working in a scenario where i'm suppose to select three option list values from the option list.
I'm using the below code to select but it doesn't seem to be working.
WebDocument webdoc = new WebDocument("/dom[@domain='10.158.118.16:28443']");
SelectTag someSelectTag =webdoc.FindSingle(".//div/fieldset/div//table//tr/td/div//select[@class='v-select-select']");
IList<OptionTag> optTag = someSelectTag.Find<OptionTag>(".//option");
IList<String> p_Name = new List<String>{"ranorex queue 1fi","ranorex queue 2fi","ranorex queue 3fi"};
int c=0;
for(int i=0; i<p_Name.Count;i++)
{
for(int k=0; k<optTag.Count; k++)
{
if(optTag[k].InnerText.Contains(p_Name))
{
Delay.Seconds(1);
optTag[k].Selected=true;
Report.Log(ReportLevel.Success,optTag[k].InnerText + " " + "Queue name has been successfully removed from the update users at Queue list ");
c=1;
}
}
if(c==0){
Report.Log(ReportLevel.Failure,"Unable to remove from update users at Queue list");
}
}