I'm getting an exception thrown when running the snippet of code below.
I have an iListof webelements, and if that element contains the string "WSC", I'd like to remove it from the iList.
Can anyone help me out? Code below.
IList<IWebElement> tableRows;
tableRows = FindElement(By.XPath("//div[@ui-grid='vm.gridWoodSmokeViolations']")).FindElements(By.XPath("//div[@role='row']"));
Console.WriteLine("table row count before loop: " + tableRows.Count);
foreach (var row in tableRows) {
if (row.Text.ToString().Contains("WSC"))
{
tableRows.Remove(row); //exception thrown here
}
}
Thanks for any help you may be able to provide