Example:
The <UL> has two values:
A role
Test Role
The script will loop through the list and find 'Test Role'. At this point, it needs to click the delete link associated with this item. My current script always clicks the delete link for 'A role', which is the first one in the list. I cannot figure out how to make it click the delete link for 'Test Role'.
Does anybody have any suggestions? I have attached screen shots of the DOM and the UI and my current script is below.
Thanks!
HtmlUnorderedList roles = ActiveBrowser.Find.ById<HtmlUnorderedList>("Roles");
HtmlAnchor a = Find.ById<HtmlAnchor>("deleteRole");
//Loop through each <li>, find role and click the delete link
foreach(HtmlListItem item in roles.AllItems)
{
if (item.TextContent.ToString() == "Test Role")
{
Log.WriteLine(item.TextContent.ToString());
a.MouseClick();
}
}