public void SkillExchange() { SkillTradeExchange.Click(); var skill = ExcelLibHelper.ReadData(rownum, "Skill"); Skill_Exchange.SendKeys(skill); Skill_Exchange.SendKeys(Keys.Enter); var skill1 = ExcelLibHelper.ReadData(rownum, "Skill1"); Skill_Exchange.SendKeys(skill1); Skill_Exchange.SendKeys(Keys.Enter); }
internal void Addingdate() { Actions actions = new Actions(Global.GlobalDefinitions.driver); //Populate the Excel sheet Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Share_Skill"); //click on share skill SSbutton.Click(); Thread.Sleep(2000); //Click on title Title.Click(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //clic on description Description.Click(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Click on Category actions.MoveToElement(Category).Build().Perform(); Thread.Sleep(1000); IList <IWebElement> Select_Cat = Category.FindElements(By.TagName("option")); Console.WriteLine("List of category" + Select_Cat); int categorycount = Select_Cat.Count; for (int i = 0; i < categorycount; i++) { if (Select_Cat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category")) { Select_Cat[i].Click(); Console.WriteLine("Category is" + Select_Cat[i].Text); Base.test.Log(LogStatus.Info, "Selected Category"); } } //Click on Sub Category actions.MoveToElement(SubCategory).Build().Perform(); Thread.Sleep(1000); IList <IWebElement> Select_SubCat = SubCategory.FindElements(By.TagName("option")); Console.WriteLine("List of category" + Select_SubCat); int Scategorycount = Select_SubCat.Count; for (int i = 0; i < Scategorycount; i++) { if (Select_SubCat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Sub-Category")) { Select_SubCat[i].Click(); Console.WriteLine("Category is" + Select_SubCat[i].Text); Base.test.Log(LogStatus.Info, "Selected Category"); } } //Add tags actions.MoveToElement(Tags).Build().Perform(); string tag1 = GlobalDefinitions.ExcelLib.ReadData(2, "Tags"); string tag2 = GlobalDefinitions.ExcelLib.ReadData(3, "Tags"); string tag3 = GlobalDefinitions.ExcelLib.ReadData(4, "Tags"); Tags.SendKeys(tag1); Tags.SendKeys(Keys.Enter); Thread.Sleep(2000); Tags2.Click(); // actions.MoveToElement(Tags2).Build().Perform(); Tags2.SendKeys(tag2); Thread.Sleep(1000); //actions.MoveToElement(Tags).Build().Perform(); //Tags.SendKeys(tag3); //Select service type actions.MoveToElement(ServiceType).Build().Perform(); IList <IWebElement> ST = ServiceType.FindElements(By.XPath("//div/input[@name='serviceType']/following-sibling :: label")); for (int i = 0; i < ST.Count; i++) { Console.WriteLine("service from web" + ST[i].Text); if (ST[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType")) { HourlyService.Click(); } else { One_off_service.Click(); } break; } //Select Location type actions.MoveToElement(LocationType).Build().Perform(); IList <IWebElement> LT = ServiceType.FindElements(By.XPath("//div/input[@name='locationType']/following-sibling :: label")); for (int i = 0; i < LT.Count; i++) { Console.WriteLine("service from web" + LT[i].Text); if (LT[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "LocationType")) { Onsite.Click(); } else { Online.Click(); } break; } //Click on start date Startdate.Click(); Thread.Sleep(1000); //Enter start date string s1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"); string[] s = s1.Split(' '); Console.WriteLine("1st part of string:" + s[0]); Console.WriteLine("2nd part of string:" + s[1]); string SD = s[0]; Startdate.SendKeys(SD); //click on enddate Enddate.Click(); //Enter End date string E1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"); string[] E = E1.Split(' '); Console.WriteLine("Enddate 1st part is:" + E[0]); Console.WriteLine("End date second part is:" + E[1]); string ED = E[0]; Enddate.SendKeys(ED); Thread.Sleep(1000); //Enter day actions.MoveToElement(Days).Build().Perform(); IList <IWebElement> Day_Name = Days.FindElements(By.XPath("//div[@class='ui checkbox']/input/following-sibling :: label")); Console.WriteLine("Days are" + Day_Name); IList <IWebElement> Day_check = Days.FindElements(By.XPath("//input[@tabindex='0' and @type='checkbox']")); Console.WriteLine("Day checkbox" + Day_check); Thread.Sleep(1000); int Day_Count = Day_Name.Count; int DayCheck_Count = Day_check.Count; for (int i = 0; i < Day_Count; i++) { if (Day_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Day")) { int j = i; Day_check[j].Click(); Console.WriteLine("selected day is" + Day_Name[i]); } } //Enter starttime Start_Time.Click(); string t1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartTime"); Console.WriteLine("Starttime is:" + t1); Start_Time.SendKeys(t1); //Enter Endtime End_Time.Click(); string ET = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndTime"); Console.WriteLine("Endtime is:" + ET); End_Time.SendKeys(ET); //Select SkillExchange actions.MoveToElement(Skill_trade).Build().Perform(); IList <IWebElement> Skill_E = Skill_trade.FindElements(By.XPath("//div/input[@name='skillTrades']/following-sibling :: label")); int SkillCount = Skill_E.Count; Console.WriteLine("count of radio buttons:" + SkillCount); for (int i = 0; i < SkillCount; i++) { if (Skill_E[i].Text == GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade")) { Console.WriteLine("Skil is" + Skill_E[i].Text); Skill_Exchange.Click(); actions.MoveToElement(Add_tags).Build().Perform(); string Tag = GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange"); Add_tags.SendKeys(Tag); Base.test.Log(LogStatus.Info, "Selected skill"); } else { Credit.Click(); actions.MoveToElement(Add_credit).Build().Perform(); string Cr = GlobalDefinitions.ExcelLib.ReadData(2, "Credit"); Add_credit.SendKeys(Cr); } break; } //Click on Worksample PlusIcon.Click(); //Performing the upload file operation using AutoIT AutoItX3 autoIT = new AutoItX3(); autoIT.WinActivate("Open"); Thread.Sleep(3000); string sample1 = GlobalDefinitions.ExcelLib.ReadData(2, "WorkSample"); Console.WriteLine("file path is" + sample1); Thread.Sleep(2000); autoIT.Send(@sample1); Thread.Sleep(3000); autoIT.Send("{Enter}"); Thread.Sleep(2000); //Downloading the file Download.Click(); //Deleting a file Delete.Click(); Thread.Sleep(500); actions.MoveToElement(Active).Build().Perform(); IList <IWebElement> Active_Name = Active.FindElements(By.XPath("//div[@class='ui radio checkbox']/input[@name='isActive']/following-sibling :: label")); Console.WriteLine("Days are" + Active_Name); IList <IWebElement> Active_radio = Active.FindElements(By.XPath("//input[@name='isActive' and @type='radio']")); Console.WriteLine("Day checkbox" + Active_radio); Thread.Sleep(1000); int Active_Count = Active_Name.Count; for (int i = 0; i < Active_Count; i++) { if (Active_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Active")) { int j = i; Active_radio[j].Click(); } } //click on save actions.MoveToElement(Buttons).Build().Perform(); IList <IWebElement> BT = ServiceType.FindElements(By.XPath("//input[@type='button']")); for (int i = 0; i < BT.Count; i++) { Console.WriteLine("Button from web" + BT.Count); if (GlobalDefinitions.ExcelLib.ReadData(2, "Buttons") == "Save") { Save.Click(); } else { Cancel.Click(); } break; } string text = Global.GlobalDefinitions.driver.Title; if (text == "ServiceListing") { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Share skill page"); } else { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Not valid page"); } }