//Update Certification on the Profile page public void UpdateCertificationOnProfile(string expectedCertificate, string from, string year) { IList <IWebElement> rows = driver.WaitForListOfElements(By.XPath("(//table[@class='ui fixed table'])[4]//tbody/tr/td[1]")); for (int rnum = 1; rnum <= rows.Count; rnum++) { string certificate = null; certificate = (driver.WaitForElement(By.XPath("(//table[@class='ui fixed table'])[4]//tbody[" + rnum + "]/tr/td[1]"))).Text; if (certificate == expectedCertificate) { //Click on Update icon to update the record driver.WaitForElement(By.XPath("(//table[@class='ui fixed table'])[4]//tbody[" + rnum + "]/tr/td[4]/span[1]/i[@class='outline write icon']")).Click(); //Update Certified From CertifiedFromTextBox.Clear(); CertifiedFromTextBox.SendKeys(from); //Update Certified Year SelectElement selectCertifiedYear = new SelectElement(CertifiedYear); selectCertifiedYear.SelectByValue(year); //Click on Update button to update From and Year of certificate UpdateButton.Click(); break; } } }
//Add new Certification on the Profile page public void AddCertificationOnProfile(string certificate, string from, string year) { //Click on AddNew button AddNewCertification.Click(); //Enter Certificate name CertificateTextBox.SendKeys(certificate); //Enter Certified From CertifiedFromTextBox.SendKeys(from); //Select Certified year SelectElement selectCertifiedYear = new SelectElement(CertifiedYear); selectCertifiedYear.SelectByText(year); //Click on Add button to add Certificate AddButton.Click(); }