//Add Education internal void AddEducation() { GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Education']"), 30); EducationButton.Click(); GlobalDefinitions.wait(30); AddNewEducation.Click(); //adding text in institute name InstituteText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "University")); // select dropdown selectdropdown("country", GlobalDefinitions.ExcelLib.ReadData(2, "Country")); selectdropdown("title", GlobalDefinitions.ExcelLib.ReadData(2, "Title")); selectdropdown("yearOfGraduation", GlobalDefinitions.ExcelLib.ReadData(2, "Year")); //enter degree DegreeText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Degree")); GlobalDefinitions.wait(30); // add education btnAddEducation.Click(); GlobalDefinitions.wait(30); }
//update education internal void UpdateEducation() { GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Education']"), 30); EducationButton.Click(); String ExpectedValue = GlobalDefinitions.ExcelLib.ReadData(2, "University"); //Get the table list IList <IWebElement> TRows = driver.FindElements(By.XPath("//table/tbody/tr")); //Get the row counts var rows = TRows.Count; //for (int i = 1; i <= rows; i++) //{ // GlobalDefinitions.wait(30); // //get xpath // String ActualValue = driver.FindElement(By.XPath("//table/tbody/tr["+i+"]/td[2]")).Text; // //check value // if (ActualValue.Equals(ExpectedValue)) // { //CliCk on update pen icon driver.FindElement(By.XPath("(//table/tbody/tr)[last()]/td[6]/span[1]/i")).Click(); //update uni IWebElement editRowValue = driver.FindElement(By.XPath("(//table/tbody/tr)[last()]/td/div/div[1]/input")); editRowValue.Clear(); editRowValue.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "University")); // update Country of College new SelectElement(driver.FindElement(By.XPath("(//table/tbody/tr)[last()]/td/div[1]/div[2]/select"))).SelectByValue(GlobalDefinitions.ExcelLib.ReadData(3, "Country")); // update Title new SelectElement(driver.FindElement(By.XPath("(//table/tbody/tr)[last()]/td/div[2]/div[1]/select"))).SelectByValue(GlobalDefinitions.ExcelLib.ReadData(3, "Title")); //update the Degree IWebElement EditDegree = driver.FindElement(By.XPath("(//table/tbody/tr)[last()]/td/div[2]/div[2]/input")); EditDegree.Clear(); EditDegree.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Degree")); //update the Year new SelectElement(driver.FindElement(By.XPath("(//table/tbody/tr)[last()]/td/div[2]/div[3]/select"))).SelectByValue(GlobalDefinitions.ExcelLib.ReadData(3, "Year")); // Click on update button // driver.FindElement(By.XPath("//table/tbody/tr[" + i + "]/td/div[3]/input[1]")).Click(); //driver.FindElement(By.XPath("//input[contains(@value,'Update')]")).Click(); UpdateButton1.Click(); GlobalDefinitions.wait(500); Thread.Sleep(5000); Console.WriteLine("updated"); // } // } }
//Delete Education internal void DeleteEduation() { GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Education']"), 30); EducationButton.Click(); // Click on the delete button driver.FindElement(By.XPath("(//table/tbody/tr)[last()]/td[6]/span[2]/i")).Click(); GlobalDefinitions.wait(30); }