//Enter Share Skill Data internal void EnterShareSkillData() { //Enter the Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter the Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category GlobalDefinitions.SelectDropDown(CategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select Sub-Category GlobalDefinitions.SelectDropDown(SubCategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n"); //Select Service Type GlobalDefinitions.SelectRadioButton(ServiceTypeOptions, GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"), By.Name("serviceType")); //Select Location Type GlobalDefinitions.SelectRadioButton(LocationTypeOption, GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"), By.Name("locationType")); //Add Start Date StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End Date EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select days and Enter start and End time EnterDaysAndTime(); //Select Skill Trade GlobalDefinitions.SelectRadioButton(SkillTradeOption, GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"), By.Name("skillTrades")); string SkillTradeValue = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToUpper(); //Enter Skill-Exchange or Credit if (SkillTradeValue == "SKILL-EXCHANGE") { SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n"); } else { CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //upload Work Samples WorkSamples.Click(); AutoItX.WinWait("Open", "File Upload", 1); AutoItX.WinActivate("Open"); AutoItX.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]"); AutoItX.Send(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\ExcelData\\empty.txt")); AutoItX.Send("{Enter}"); //Select Active radio GlobalDefinitions.SelectRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active"), By.Name("isActive")); }
internal void EnterShareSkillData() { //Enter the Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter the Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category GlobalDefinitions.SelectDropDown(CategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select Sub-Category GlobalDefinitions.SelectDropDown(SubCategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n"); //Select Service Type GlobalDefinitions.SelectRadioButton(ServiceTypeOptions, GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"), By.Name("serviceType")); //Select Location Type GlobalDefinitions.SelectRadioButton(LocationTypeOption, GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"), By.Name("locationType")); //Add Start Date StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End Date EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Getting all the values in Selectday column in a list IList <string> DaysList = GlobalDefinitions.ExcelLib.ReadData(2, "Selectday").Split('/'); //Getting count for all days //Check the checkbox for selectdays mentioned in excel and enter time for same int DaysRows = Days.FindElements(By.Name("Available")).Count; foreach (string AvailableDays in DaysList) { for (int i = 1; i <= DaysRows; i++) { string DayValue = Days.FindElements(By.ClassName("fields"))[i].Text; if (AvailableDays.ToLower() == DayValue.ToLower()) { Days.FindElements(By.Name("Available"))[i - 1].Click(); string StartTime = DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt"); Days.FindElements(By.Name("StartTime"))[i - 1].SendKeys(StartTime); string EndTime = DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt"); Days.FindElements(By.Name("EndTime"))[i - 1].SendKeys(EndTime); break; } } } //Select Skill Trade GlobalDefinitions.SelectRadioButton(SkillTradeOption, GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"), By.Name("skillTrades")); string SkillTradeValue = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToUpper(); //Enter Skill-Exchange or Credit if (SkillTradeValue == "SKILL-EXCHANGE") { SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n"); } else { CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //upload Work Samples WorkSamples.Click(); AutoItX.WinWait("Open", "File Upload", 1); AutoItX.WinActivate("Open"); AutoItX.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]"); AutoItX.Send(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\ExcelData\\empty.txt")); AutoItX.Send("{Enter}"); //Select Active radio GlobalDefinitions.SelectRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active"), By.Name("isActive")); }
//Edit the Existing share Skill internal void EditShareSkillData() { Extension.WaitForElementDisplayed(Driver, By.Name("title"), 5); //Clear the Title Title.Clear(); //Enter the Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Clear the Description Description.Clear(); //Enter the Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select Sub-Category GlobalDefinitions.SelectDropDown(SubCategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Clear the Entered tag foreach (IWebElement removeTag in RemoveTags) { removeTag.Click(); } //Enter Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n"); //Select Service Type GlobalDefinitions.SelectRadioButton(ServiceTypeOptions, GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"), By.Name("serviceType")); //Select Location Type GlobalDefinitions.SelectRadioButton(LocationTypeOption, GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"), By.Name("locationType")); //Add Start Date StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End Date EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Clear the Available days data int DaysRows = Days.FindElements(By.Name("Available")).Count; for (int i = 1; i <= DaysRows; i++) { if (Days.FindElements(By.Name("Available"))[i - 1].Selected) { Days.FindElements(By.Name("Available"))[i - 1].Click(); Days.FindElements(By.Name("StartTime"))[i - 1].SendKeys(Keys.Delete); Days.FindElements(By.Name("EndTime"))[i - 1].SendKeys(Keys.Delete); } } //Select days and Enter start and End time EnterDaysAndTime(); //Select Skill Trade GlobalDefinitions.SelectRadioButton(SkillTradeOption, GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"), By.Name("skillTrades")); string SkillTradeValue = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToUpper(); //Enter Skill-Exchange or Credit if (SkillTradeValue == "SKILL-EXCHANGE") { SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n"); } else { CreditAmount.Clear(); CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //Select Active radio GlobalDefinitions.SelectRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active"), By.Name("isActive")); }