internal void EnterShareSkill() { int rows; rows = GlobalDefinitions.ExcelLib.NumberofRows(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); Thread.Sleep(1500); for (int i = 2; i <= rows + 1; i++) { Thread.Sleep(1500); //Click on Share Skill ShareSkillButton.Click(); //Enter Title Thread.Sleep(3500); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Title")); //Enter Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Description")); //Enter Category CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Category")); //Enter Sub-Category SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "SubCategory")); //Enter Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Tags")); Tags.SendKeys(Keys.Enter); //Enter ServiceType String Service = GlobalDefinitions.ExcelLib.ReadData(i, "ServiceType"); if (Service == "One-off service") { ServiceTypeOptions.FindElement(By.XPath("/ html / body / div / div / div[1] / div[2] / div / form / div[5] / div[2] / div[1] / div[2] / div / input")).Click(); } else { ServiceTypeOptions.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click(); } //Enter LocationType String LocationType = GlobalDefinitions.ExcelLib.ReadData(i, "LocationType"); if (LocationType == "On-site") { LocationTypeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click(); } else { LocationTypeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click(); } //Enter Startdate //StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate").ToString()); //Enter Enddate // EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Enter Selectday // String Day=GlobalDefinitions.ExcelLib.ReadData(2, "Selectday"); //if(Day== "Sun") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[2]/div[1]/div/input")).Click(); //} //else if(Day=="Mon") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[3]/div[1]/div/input")).Click(); // } //else if (Day == "Tue") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[4]/div[1]/div/input")).Click(); //} //else if (Day == "Wed") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[5]/div[1]/div/input")).Click(); //} //else if (Day == "Thu") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[6]/div[1]/div/input")).Click(); //} //else if (Day == "Fri") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[7]/div[1]/div/input")).Click(); //} //else if (Day == "Sat") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[8]/div[1]/div/input")).Click(); //} //Enter Starttime // StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Starttime")); //Enter Endtime // EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Endtime")); //Enter SkillTrade string SkillTrade = GlobalDefinitions.ExcelLib.ReadData(i, "SkillTrade"); if (SkillTrade == "Skill-Exchange") { SkillTradeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[1]/div/label")).Click(); } else { SkillTradeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[2]/div/label")).Click(); } //Enter Skill-Exchange SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Enter Credit if (SkillExchange.Text == "Credit") { CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Credit")); } ////Work Sample Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[9]/div/div[2]/section/div/label/div/span/i")).Click(); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); Thread.Sleep(1500); autoit.ControlSetText("Open", "", "Edit1", StrSendText); autoit.ControlClick("Open", "", "Button1"); //Enter Active string Active = GlobalDefinitions.ExcelLib.ReadData(i, "Active"); if (Active == "Active") { ActiveOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click(); } else { ActiveOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[2]/div/input")).Click(); } //Click on save Save.Click(); Thread.Sleep(1500); } }
internal void EnterShareSkill() { //GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\kranthi\source\repos\marsframework-master\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); By WaitCondition = By.XPath("//a[text()=\"Share Skill\"]"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition, 60); //Click on ShareSkill button to enter the details of skill ShareSkillButton.Click(); By WaitCondition1 = By.XPath("//input[@name='title']"); GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, WaitCondition1, 60); //Enter value for Title field Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter value for Description field Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select value for Category SelectElement Category = new SelectElement(CategoryDropDown); Category.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select value for SubCategory SelectElement SubCategory = new SelectElement(SubCategoryDropDown); SubCategory.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter tag Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); //Select Service type string ServiceType = GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"); if (ServiceType == "One-off service") { ServiceTypeOptions.FindElement(By.XPath("//label[contains(text(),'One-off')]")).Click(); } else { ServiceTypeOptions.FindElement(By.XPath("//label[contains(text(),'Hourly')]")).Click(); } //Select Location type string LocationType = GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"); if (LocationType == "On-site") { LocationTypeOption.FindElement(By.XPath("//label[contains(text(),'On-site')]")).Click(); } else { LocationTypeOption.FindElement(By.XPath("//label[contains(text(),'Online')]")).Click(); } //Enter Calender values //SelectElement StartDate = new SelectElement(StartDateDropDown); //Click on Skill-Trade Option string SkillTrade = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"); if (SkillTrade == "Skill-Exchange") { SkillTradeOption.FindElement(By.XPath("//label[contains(text(),'Skill-exchange')]")).Click(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); } else { SkillTradeOption.FindElement(By.XPath("//label[contains(text(),'Credit')]")).Click(); CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CreditAmount")); } IWebElement Sample = GlobalDefinitions.driver.FindElement(By.XPath("//i[@class='huge plus circle icon padding-25']")); Sample.Click(); Thread.Sleep(1500); AutoItX3 AutoIT = new AutoItX3(); AutoIT.WinActivate("Open"); Thread.Sleep(1500); AutoIT.Send(Base.ImagePath); Thread.Sleep(1500); AutoIT.Send("{ENTER}"); //Click on Active field string Activefield = GlobalDefinitions.ExcelLib.ReadData(2, "Active"); if (Activefield == "Active") { ActiveOption.FindElement(By.XPath("//label[contains(text(),'Active')]")); } else { ActiveOption.FindElement(By.XPath("//label[contains(text(),'Hidden')]")); } Save.Click(); }