public void DeleteSkills() { GlobalDefinitions.Wait(); SkillLink.Click(); IWebElement Delete = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']//tbody[1]//tr[1]//td[3]//span[2]")); Delete.Click(); //for deleting skill details IWebElement AddAlertPopup = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner")); String AlertText = AddAlertPopup.Text; GlobalDefinitions.Wait(); Assert.IsTrue(AlertText.Contains("deleted")); Console.WriteLine(AlertText); //Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills deleted successfully"); var ScreenshotPath = Global.SaveScreenshot.SaveScreenshotClass(GlobalDefinitions.driver, "Skills deleted successfully"); }
public void EditSkills() { Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkills"); GlobalDefinitions.Wait(); SkillLink.Click(); //This list gets the number of rows from the table //IList<IWebElement> rows = GlobalDefinitions.driver.FindElements(By.XPath(".//tr")); //This loop finds the first row which' title matches sRowValue IList <IWebElement> rows = GlobalDefinitions.driver.FindElements(By.XPath(".//tr")); //This loop finds the first row which' title matches sRowValue for (int i = 1; i < rows.Count; i++) { String sValue = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'C#')]")).Text; if (sValue == ExcelLib.ReadData(2, "Skill")) { IWebElement Edit = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']//tbody[1]//tr[1]//td[3]//span[1]//i[1]")); Edit.Click(); AddSkillText.Clear(); AddSkillText.SendKeys(ExcelLib.ReadData(7, "Skill")); UpdateSkill.Click(); break; } } GlobalDefinitions.Wait(); IWebElement AddAlertPopup = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner")); String AlertText = AddAlertPopup.Text; GlobalDefinitions.Wait(); Assert.IsTrue(AlertText.Contains("updated")); Console.WriteLine(AlertText); //saving screenshot var ScreenshotPath = Global.SaveScreenshot.SaveScreenshotClass(GlobalDefinitions.driver, "Edit is successful"); }
public void AddSkills() { //Populate the Excel Sheet Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkills"); GlobalDefinitions.Wait(); SkillLink.Click(); //loop for multiple properties getting added at single shot int loopNum = Base.RowCount + 2; for (int rowNum = 2; rowNum <= loopNum; rowNum++) { GlobalDefinitions.Wait(); AddNewSkillBtn.Click(); AddSkillText.SendKeys(ExcelLib.ReadData(rowNum, "Skill")); //ChooseLang.SendKeys(ExcelLib.ReadData(2, "ChooseLangLevel")); ChooseSkill.Click(); IWebElement SkillLevelDrpdwn = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']//select[@name='level']")); SelectElement chooseSkillLevel = new SelectElement(SkillLevelDrpdwn); //select.SelectByText(ConstantHelpers.LevelFluent); var SkillLevelData = ExcelLib.ReadData(rowNum, "ChooseSkillLevel"); chooseSkillLevel.SelectByValue(SkillLevelData); AddSkill.Click(); //GlobalDefinitions.Wait(); } //saving screenshot var ScreenshotPath = Global.SaveScreenshot.SaveScreenshotClass(GlobalDefinitions.driver, "Adding is successful"); //Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills added successfully"); String ActualSkill = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'C#')]")).Text; Assert.AreEqual(ActualSkill, ExcelLib.ReadData(2, "Skill")); Console.WriteLine("Skill" + " " + ActualSkill + " " + "is added"); GlobalDefinitions.Wait(); String ActualSkill1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'POM')]")).Text; Assert.AreEqual(ActualSkill1, ExcelLib.ReadData(3, "Skill")); Console.WriteLine("Skill" + " " + ActualSkill1 + " " + "is added"); GlobalDefinitions.Wait(); String ActualSkill2 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Nunit')]")).Text; Assert.AreEqual(ActualSkill2, ExcelLib.ReadData(4, "Skill")); Console.WriteLine("Skill" + " " + ActualSkill2 + " " + "is added"); //Reading Language Level from Data excel sheet //Asserting the Skill level String ActualLevel = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Intermediate')]")).Text; Assert.AreEqual(ActualLevel, ExcelLib.ReadData(2, "ChooseSkillLevel")); Console.WriteLine("Level" + " " + ActualLevel + " " + "is added"); GlobalDefinitions.Wait(); String ActualLevel1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Expert')]")).Text; Assert.AreEqual(ActualLevel1, ExcelLib.ReadData(3, "ChooseSkillLevel")); Console.WriteLine("Level" + " " + ActualLevel1 + " " + "is added"); GlobalDefinitions.Wait(); String ActualLevel2 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Expert')]")).Text; Assert.AreEqual(ActualLevel2, ExcelLib.ReadData(4, "ChooseSkillLevel")); Console.WriteLine("Level" + " " + ActualLevel2 + " " + "is added"); }