//Function to Delete Record Which is added automatically internal void DeleteAutomatedRecord(int dataRow) { //Initialize Excel File GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SkillDetails"); string autoText = GlobalDefinitions.ExcelLib.ReadData(dataRow, "Title"); int CheckRow = GlobalDefinitions.driver.FindElements(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr")).Count(); for (int i = 1; i <= CheckRow; i++) { IWebElement CheckString = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); if (CheckString.Text == autoText) { GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[8]/div/button[3]/i")).Click(); AlertYes.Click(); break; } } }
//Function to check if record is exist internal void DeleteRecordIfExist(int dataRow) { // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[3]") , 10); //Get Title From Excel to check record GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SkillDetails"); string getTitle = GlobalDefinitions.ExcelLib.ReadData(dataRow, "Title"); int CheckRow = GlobalDefinitions.driver.FindElements(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr")).Count(); for (int i = 1; i <= CheckRow; i++) { IWebElement CheckString = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); if (CheckString.Text == getTitle) { GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[8]/div/button[3]/i")).Click(); AlertYes.Click(); break; } } }
internal void ClickOnDeleteBtn() { GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr/td[8]/div/button[3]/i"), 10); deleteBtn.Click(); AlertYes.Click(); }