//Delete a given Certification internal void DeleteCertification() { CertificationsButton.Click(); ExcelLibHelper.PopulateInCollection(ConstantHelpers.TestDataPath, "FieldValues"); String expectedValue1 = ExcelLibHelper.ReadData(4, "Certificate"); //Get the row list IList <IWebElement> Trows = driver.FindElements(By.XPath("//form/div[5]/div/div[2]/div/table/tbody/tr")); //Get the row count of table var rows = Trows.Count; for (int i = 1; i <= rows; i++) { //Get the xpath of ith row Name String actualValue = driver.FindElement(By.XPath("//form/div[5]/div/div[2]/div/table/tbody[" + i + "]/tr/td[1]")).Text; if (actualValue == expectedValue1) { // Click on delete button driver.FindElement(By.XPath("//form/div[5]/div[1]/div[2]/div/table/tbody[" + i + "]/tr/td[4]/span[2]/i")).Click(); } } }
//Delete a given language internal void DeleteCertification() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Certifications']"), 30); //click on certification tab CertificationsButton.Click(); String expectedValue1 = GlobalDefinitions.ExcelLib.ReadData(2, "Certificate"); //Get the row list IList <IWebElement> Trows = driver.FindElements(By.XPath("//form/div[5]/div/div[2]/div/table/tbody/tr")); //Get the row count of table var rows = Trows.Count; for (int i = 1; i <= rows; i++) { //Get the xpath of ith row Name String actualValue = driver.FindElement(By.XPath("//form/div[5]/div/div[2]/div/table/tbody[" + i + "]/tr/td[1]")).Text; if (actualValue == expectedValue1) { // Click on delete button driver.FindElement(By.XPath("//form/div[5]/div[1]/div[2]/div/table/tbody[" + i + "]/tr/td[4]/span[2]/i")).Click(); break; } } }
//Add Certification internal void AddCertification() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Certifications']"), 30); //click on certification tab CertificationsButton.Click(); GlobalDefinitions.wait(30); //add new certification AddNewCertification.Click(); GlobalDefinitions.wait(30); //add value in certificate field and certification from CertificationText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Certificate")); CertifiedFromText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CertifiedFrom")); //select certificate year selectdropdown("certificationYear", GlobalDefinitions.ExcelLib.ReadData(2, "CertificationYear")); btnAddCertification.Click(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15); }
//update operation performs on Certification field internal void UpdateCertification() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Certifications']"), 30); //click on certification tab CertificationsButton.Click(); GlobalDefinitions.wait(30); //click the pen icon to edit CerficationUpdate.Click(); GlobalDefinitions.wait(30); // clear text and enter value CertificationText.Clear(); CertificationText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Certificate")); CertifiedFromText.Clear(); CertifiedFromText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "CertifiedFrom")); selectdropdown("certificationYear", GlobalDefinitions.ExcelLib.ReadData(3, "CertificationYear")); //click on update button UpdateButton.Click(); GlobalDefinitions.wait(30); //Console.WriteLine(driver.FindElement(By.XPath("//div[contains(@class,'ns-box-inner')]")).Text); //driver.FindElement(By.XPath("//a[contains(@class,'ns-close')]")); Console.WriteLine("*******************************"); }