While working with selenium webdriver in C#, I am encountering an issue. Below is the code to click on the icon, which is marked in the red area(in the image).
IWebDriver driver = new ChromeDriver(options);
IList<IWebElement> status = driver.FindElements(By.XPath("//table[@id='tblFileList']//tr//td[contains(text(),'New')]"));
for (int i = 0; i < status.Count; i++)
{
action.DoubleClick(status[i]).Build().Perform();
Thread.Sleep(2000);
i++;
}
Problem:
The above code clicks on the icon, but it starts clicking on the icon from 0 index. Let's say, if the loop is running for 7th time then it will start clicking on the icon from 0 index to 6 index.
What is the possible fix for this?