I'm actually trying to remove the element from IList if certain condition occurs, but seems like I'm getting the same list .Count
number. Below is my code:
[FindsBy(How = How.XPath, Using = "//button[@aria-label='delete']")]
private IList <IWebElement> _deleteIcons;
******** SOME CODE HERE **********
for (var i = 0; i<_deleteIcons.Count; i++)
{
if (_deleteIcons[i].GetAttribute("disabled").Contains("true"))
{
_deleteIcons.RemoveAt(i);
}
}
Debug.WriteLine(_deleteIcons.Count);
Imagine there are 6 total elements in the IList, and 2 of them contain "disabled" =="true"
At the end I would like to write to debug console the variable count and see 4. Currently once the piece of code is run, I still get the same amount of 6 elements in IList.