public void AddShareSkill(IWebDriver Driver) { //Click Share Skill button ShareSkillBtn.Click(); Thread.Sleep(5000); //Title Input Title.SendKeys(Helpers.ExcelLib.ReadData(2, "Title")); //Description Input Description.SendKeys(Helpers.ExcelLib.ReadData(2, "Description")); //Select Category var selectElement1 = new SelectElement(Category); selectElement1.SelectByValue("6"); Console.WriteLine("Category selcted"); //Select Sub-Catergory var selectElement2 = new SelectElement(Subcategory); selectElement2.SelectByText("QA"); Console.WriteLine("Sub-Category selcted"); //Select Tags Tag1.SendKeys(Helpers.ExcelLib.ReadData(2, "Tag1")); Tag1.SendKeys(Keys.Enter); Console.WriteLine("Enter clicked"); //Select Service Type Servicetype.Click(); //Select Location Type Locationtype.Click(); //Select End date Enddate.SendKeys("29-07-2019"); //Input for the whole week //Monday time MonCheck.Click(); MonStart.SendKeys(Helpers.ExcelLib.ReadData(2, "MonStart")); MonEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "MonEnd")); //Tuesday time TuesCheck.Click(); TuesStart.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesStart")); TuesEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesEnd")); //Wednesday time WedCheck.Click(); WedStart.SendKeys(Helpers.ExcelLib.ReadData(2, "WedStart")); WedEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "WedEnd")); //Thursday time ThursCheck.Click(); ThursStart.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursStart")); ThursEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursEnd")); //Friday time FriCheck.Click(); FriStart.SendKeys(Helpers.ExcelLib.ReadData(2, "FriStart")); FriEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "FriEnd")); //Select Skill trade SkillTrade.Click(); //Select Skill Exchange SkillExchange.SendKeys(Helpers.ExcelLib.ReadData(2, "SkillExchange")); SkillExchange.SendKeys(Keys.Enter); //Upload Work Sample Upload click IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver; js1.ExecuteScript("arguments[0].click();", Upload); Thread.Sleep(5000); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf"); Thread.Sleep(4000); autoIt.Send("{ENTER}"); //Select Active SkillActive.Click(); //Click Save Savebtn.Click(); Thread.Sleep(5000); //Verification //CommonDriver.Driver.FindElement(By.XPath("//a[contains(text(),'Manage Listings')]")).Click(); //string ExpectedResult1 = "Software Tester 7"; //string ActualResult1 = CommonDriver.Driver.FindElement(By.XPath("//td[contains(text(),'q')]")).Text; //if (ActualResult1 == ExpectedResult1) //{ // Console.WriteLine("Test Pass: Skill Added"); //} //else //{ // Console.WriteLine("Test Fail: Skill Not Added"); //} try { Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed); Console.WriteLine("Test Pass: Skill listing Added"); } catch (Exception e) { Console.WriteLine(e); } }
internal void AddShareSkill(IWebDriver Driver) { //Populate the Excel sheet Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ShareSkillTestData"); Thread.Sleep(1000); //Click Share Skill button ShareSkillBtn.Click(); Thread.Sleep(5000); //Title Input Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Description Input Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category var selectElement1 = new SelectElement(Category); selectElement1.SelectByValue("6"); Console.WriteLine("Category selcted"); //Select Sub-Catergory var selectElement2 = new SelectElement(Subcategory); selectElement2.SelectByText("QA"); Console.WriteLine("Sub-Category selcted"); //Select Tags Tag1.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tag1")); Tag1.SendKeys(Keys.Enter); Console.WriteLine("Enter clicked"); //Select Service Type Servicetype.Click(); //Select Location Type Locationtype.Click(); //Select End date Enddate.SendKeys("29-07-2019"); //Input for the whole week //Monday time MonCheck.Click(); MonStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonStart")); MonEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonEnd")); //Tuesday time TuesCheck.Click(); TuesStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesStart")); TuesEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesEnd")); //Wednesday time WedCheck.Click(); WedStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedStart")); WedEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedEnd")); //Thursday time ThursCheck.Click(); ThursStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursStart")); ThursEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursEnd")); //Friday time FriCheck.Click(); FriStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriStart")); FriEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriEnd")); //Select Skill trade SkillTrade.Click(); //Select Skill Exchange SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange")); SkillExchange.SendKeys(Keys.Enter); ////Upload Work Sample Upload click IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver; js1.ExecuteScript("arguments[0].click();", Upload); Thread.Sleep(5000); AutoItX3 autoIt = new AutoItX3(); Thread.Sleep(5000); autoIt.WinActivate("Open"); autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf"); Thread.Sleep(4000); autoIt.Send("{ENTER}"); //Select Active SkillActive.Click(); //Click Save Savebtn.Click(); Thread.Sleep(5000); Base.test.Log(LogStatus.Info, "Skill added successfully"); //Verification Thread.Sleep(4000); string ExpectedResult1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"); string ActualResult1 = ActualValue1.Text; if (ActualResult1 == ExpectedResult1) { Console.WriteLine("Test Pass: Skill Added"); // Screenshot String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); //AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\"); Base.test.Log(LogStatus.Info, "Image example: " + img); // end test. (Reports) Base.extent.EndTest(Base.test); // calling Flush writes everything to the log file (Reports) Base.extent.Flush(); // Close the driver :) //GlobalDefinitions.driver.Close(); } else { Console.WriteLine("Test Fail: Skill Not Added"); } //try //{ // Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed); // Console.WriteLine("Test Pass: Skill listing Added"); //} //catch (Exception e) //{ // Console.WriteLine("Test Fail: Skill listing not present"); //} }