//Delete a given language internal void DeleteLanguage() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Languages']"), 30); LanguageButton.Click(); //expected value of language String expectedValue = GlobalDefinitions.ExcelLib.ReadData(2, "Language"); String expectedValue1 = GlobalDefinitions.ExcelLib.ReadData(3, "Language"); //Get the table row list IList <IWebElement> Tablerows = (IList <IWebElement>)driver.FindElements(By.XPath("//form/div[2]/div/div[2]/div/table/tbody/tr")); //Count how many rows var rowCount = Tablerows.Count; for (int i = 1; i <= rowCount; i++) { //xpath of ith languagename(row) String actualValue = driver.FindElement(By.XPath("//div/table/tbody[" + i + "]/tr/td[1]")).Text; if ((expectedValue == actualValue) || (expectedValue1 == actualValue)) { //click on delete icon driver.FindElement(By.XPath("//div/table/tbody[" + i + "]/tr/td[3]/span[2]/i")).Click(); Console.WriteLine("Langugae deleted"); break; } } }
//Add new Lanuguage internal void Addlanguage() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Languages']"), 30); //firstly click on language button LanguageButton.Click(); //implicit wait GlobalDefinitions.wait(30); //click on add new button AddNewLanguage.Click(); GlobalDefinitions.wait(30); //enter text in language field LanguageText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Language")); //select level from drop down new SelectElement(driver.FindElement(By.XPath("//select[@class='ui dropdown']"))).SelectByValue(GlobalDefinitions.ExcelLib.ReadData(2, "LanguageLevel")); GlobalDefinitions.wait(30); //click on add button AddLanguage.Click(); GlobalDefinitions.wait(30); }
//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); }
//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 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; } } }
//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("*******************************"); }
//Add Skills internal void AddSkill() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Skills']"), 30); //click on skill SkillsButton.Click(); GlobalDefinitions.wait(30); //click on add new button AddNewSkills.Click(); GlobalDefinitions.wait(30); //GlobalDefinitions.WaitForElement("//input[contains(@placeholder,'Add Skill')]"); //add value in skill text SkillsText.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill")); //Skill level new SelectElement(driver.FindElement(By.XPath("//select[@class='ui fluid dropdown']"))).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SkillLevel")); //click on add button btnAddSkill.Click(); GlobalDefinitions.wait(30); }
//Delete a given language internal void DeleteSkill() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Skills']"), 30); //click on skill SkillsButton.Click(); String expectedvalue = GlobalDefinitions.ExcelLib.ReadData(2, "Skill"); String expectedvalue1 = GlobalDefinitions.ExcelLib.ReadData(3, "Skill"); //table row IList <IWebElement> Tablerows = driver.FindElements(By.XPath("//form/div[3]/div/div[2]/div/table/tbody/tr")); //Get the row count of table var rowCount = Tablerows.Count; for (int i = 1; i <= rowCount; i++) { //Get the xpath of skill name //div/table/tbody[" + i + "]/tr/td[1] String actualValue = driver.FindElement(By.XPath("//div/table/tbody[" + i + "]/tr/td[1]")).Text; // String actualValue = driver.FindElement(By.XPath("//div[3]/div/div[2]/div/table/tbody[" + i + "]/tr/td[1]")).Text; //validate if ((expectedvalue == actualValue) || (expectedvalue1 == actualValue)) { driver.FindElement(By.XPath("//div/table/tbody[" + i + "]/tr/td[3]/span[2]/i")); Console.WriteLine("Deleted"); break; } } }
//Update skill internal void UpdateSkill() { //explicit wait GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Skills']"), 30); //click on skill SkillsButton.Click(); GlobalDefinitions.wait(30); //get text of skill var skilltext = driver.FindElement(By.XPath("//table/tbody/tr[last()]/td[1]")).Text; GlobalDefinitions.wait(30); //click on pen icon update driver.FindElement(By.XPath("//table/tbody/tr[last()]/td[3]/span[1]")).Click(); //get skill text box IWebElement skilledittext1 = driver.FindElement(By.XPath("//table/tbody/tr[last()]/td/div/div[1]/input")); skilledittext1.Clear(); //enter skill skilledittext1.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Skill")); //click on update driver.FindElement(By.XPath("//table/tbody/tr[last()]/td/div/span/input[1]")).Click(); }
//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); }
internal void GoToChangePassword() { try { Thread.Sleep(2000); //GlobalDefinitions.WaitForElement(driver, By.CssSelector("span[class='item ui dropdown link active visible']"), 40); //driver.FindElement(By.CssSelector("span[class='item ui dropdown link active visible']")).Click(); driver.FindElement(By.XPath("//span[contains(text(), 'Hi ')]")).Click(); // driver.FindElement(By.XPath("//span[contains(@tabindex,'0')]")).Click(); // ddlHi.Click(); //Thread.Sleep(1000); GlobalDefinitions.WaitForClickableElement(driver, By.XPath("//a[text()='Change Password']"), 30); btnChangePassword.Click(); }catch (Exception ex) { Console.WriteLine(ex.Message); } }