public void WhenUserClicksOnAnyOfTheAccountListed() { try { List <IWebElement> rows = new List <IWebElement>(AccountsPage.TableElement(SelectBrowser.driver).FindElements(By.TagName("tr"))); rowscount = rows.Count; List <IWebElement> columns = new List <IWebElement>(SelectBrowser.driver.FindElements(By.XPath("//table[@id='accounts-jeopardy']//tbody//tr[1]/td"))); colcount = columns.Count; for (int rownum = 1; rownum <= rowscount - 2; rownum++) { List <IWebElement> rowCells = new List <IWebElement>(SelectBrowser.driver.FindElements(By.XPath("//table[@id='accounts-jeopardy']//tbody//tr[" + rownum + "]/td"))); for (int CellNumber = 0; CellNumber < rowCells.Count; CellNumber++) { string text = rowCells.ElementAt(CellNumber).Text; IWebElement element = rowCells.ElementAt(CellNumber).FindElement(By.TagName("a")); string textpresent = element.Text; if (textpresent.Contains(ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0))) { Synchronization.VisibleElement(SelectBrowser.driver, By.TagName("a")); element.Click(); test.Log(Status.Pass, "Clicked on the Account==>" + ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0)); break; } } break; } } catch (Exception ex) { Console.WriteLine("Exception==>" + ex); ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png); } }