internal void DeleteShareSkill() { try { //Click on Manage Listings ManageListings.Click(); GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ManageListingExcelPath, "ManageListings"); string FirstPath = "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr["; string SecondPath = "]/td[3]"; string getTitle = null; bool flag = false; int temp = 0; while (true) { for (int rownum = 1; rownum <= (Totalrows.Count); rownum++) { getTitle = GlobalDefinitions.driver.FindElement(By.XPath(FirstPath + rownum + SecondPath)).Text; temp = 1; if (getTitle == GlobalDefinitions.ExcelLib.ReadData(2, "Title")) { if (GlobalDefinitions.ExcelLib.ReadData(2, "Deleteaction") == "Yes") { //Click on Delete GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[3]/i")).Click(); GlobalDefinitions.wait(10000); Yes.Click(); GlobalDefinitions.wait(10000); Assert.Pass("Record is successfully deleted"); flag = true; return; } else { //Click on Delete GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[3]/i")).Click(); GlobalDefinitions.wait(10000); No.Click(); GlobalDefinitions.wait(10000); Assert.Pass("There is matching record but it is not deleted"); flag = true; return; } } } if (flag == false) { NextPage.Click(); } if (temp == 1) { Assert.Pass("There is no matching record to delete"); } } } catch (Exception ex) { Console.WriteLine(ex.Message);; } }