I am trying to create some code that when run tells me if objects were added or removed from a dropdown.
The code I have currently is not working.
I think I may need to convert the objects into strings then add them to a list then compare it with my other list.
IList<ATag> currentList2 = filterOptions.FindDescendants<ATag>();
System.Collections.Generic.List<string> DropdownOps2 = new System.Collections.Generic.List<string>();
DropdownOps2.Add("My Campaigns");
DropdownOps2.Add("My Group");
DropdownOps2.Add("All");
DropdownOps2.Add("Test");
foreach(ATag item in currentList2)
{
string itm = item.InnerText.ToString();
foreach (String value in DropdownOps2){
if(!DropdownOps2.Contains(itm))
Ranorex.Report.Warn(value);
}
if (DropdownOps2.Contains(itm))
Ranorex.Report.Success(itm + " is available");
else
Ranorex.Report.Warn(item + " is not available");
}
Trying to log when objects in dropdown are changed
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Trying to log when objects in dropdown are changed
Hi Rebus,
You can try to use a foreach loop in order to convert the "currentList2" to a string list.
Bernhard
You can try to use a foreach loop in order to convert the "currentList2" to a string list.
System.Collections.Generic.List<string> currentStringList = new System.Collections.Generic.List<string>(); foreach(ATag item in currentList2) { string itm = item.InnerText.ToString(); currentStringList.Add(itm); }Regards,
Bernhard