internal void EnterShareSkill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //Click on Join button ShareSkillButton.Click(); // Enter Title on ShareSkill page Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); // Enter discription on ShareSkill page Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); // Select category dropdown on share skil page CategoryDropDown.Click(); // Enter tag names in taxbox Tags.Click(); //Select service type type on share skill page ServiceTypeOptions.Click(); // Select location type on share skill page LocationTypeOption.Click(); // Sorting Start time StartTime.Click(); // Select start date drop down StartDateDropDown.Click(); // Select End date drop down on share skill page EndDateDropDown.Click(); // Select available days Days.Click(); // Select start time on share skill page StartTimeDropDown.Click(); // Select end time on share skill page EndTimeDropDown.Click(); // Click on skill trade option SkillTradeOption.Click(); // Select skill exchange option SkillExchange.Click(); // Enter credit ammount on share skill page CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "credit amount")); // Click on Active option on share skill page ActiveOption.Click(); // click on save button on share skill page Save.Click(); Thread.Sleep(2000); }
internal void EditShareSkill() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(AppDomain.CurrentDomain.BaseDirectory.Replace(@"MarsFramework\bin\Debug\", @"MarsFramework\ExcelData\TestDataManageListings.xlsx"), "ManageListings"); //Wait for Manage Listings to appear GlobalDefinitions.WaitForElement(GlobalDefinitions.Driver, By.LinkText("Manage Listings"), (20)); //Click on Manage Listings manageListingsLink.Click(); //Wait for the Title of the listing to appear GlobalDefinitions.WaitForElement(GlobalDefinitions.Driver, By.XPath("//*[contains(text(),'Selenium')]"), (20)); //See if listing is displayed and click on edit icon of that listing if (EditListingsLink.Displayed && edit.Displayed) { if (EditListingsLink.Text == "Selenium" && edit.Equals(GlobalDefinitions.Driver.FindElement(By.XPath(("//i[@class='outline write icon']"))))) { edit.Click(); //wait for the title to appear GlobalDefinitions.WaitForElement(GlobalDefinitions.Driver, By.XPath("//input[contains(@name,'title')]"), 20); //click on title Title.Click(); //clear the title Title.Clear(); //update the title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(1, "Title")); //click on Description Description.Click(); //clear the description Description.Clear(); //update the description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(1, "Description")); //Click on category dropdown CategoryDropDown.Click(); //Choose programming and tech from drop down menu GlobalDefinitions.ExcelLib.ReadData(1, "Category" + Keys.Enter); //Click on subcategory dropdown SubCategoryDropDown.Click(); GlobalDefinitions.ExcelLib.ReadData(1, "SubCategory" + Keys.Enter); //Click on save button to apply changes Save.Click(); Thread.Sleep(2000); } } }
internal void FillDetails(int DataRow) { //Check if the user is able to Enter Text in the "Title" field EnterText(DataRow); //Check if the user is able to "Click" on the "Category" dropdown list CategoryDropDown.Click(); CategoryDropDown.SendKeys(Keys.ArrowDown + Keys.Enter); //Check if the user is able to "Click" on the "SubCategory" dropdown list SubCategoryDropDown.Click(); SubCategoryDropDown.SendKeys(Keys.ArrowDown + Keys.Enter); //Check if the user is able to "Enter" a "Tag" Tags.SendKeys(GlobalDefinitions.ReadData(DataRow, "Tag") + Keys.Enter); //Check if the user is able to "Click" on a "Service Type" option ServiceTypeOptions.Click(); //Check if the user is able to "Click" on a "Location Type" option LocationTypeOption.Click(); }
internal void AddShareSkill() { //populate excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); try { //Click on Share skill button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Share Skill", 10000); ShareSkillButton.Click(); //Enter the Title in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "title", 10000); Title.Click(); Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter the Description in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "description", 10000); Description.Click(); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "categoryId", 10000); CategoryDropDown.Click(); new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "subcategoryId", 10000); SubCategoryDropDown.Click(); new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tag names in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='']", 10000); Tags.Click(); Tags.Clear(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); //Select service type GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000); ServiceTypeOptions.Click(); Servicetyp.Click(); //Select the Location Type GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); LocationTypeOption.Click(); LocationSel.Click(); //Add start date StartDateDropDown.Click(); // StartDateDropDown.Clear(); StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End date EndDateDropDown.Click(); //EndDateDropDown.Clear(); EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select available day GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//body/div/div/div[@id='service-listing-section']/div[@class='ui container']/div[@class='listing']/form[@class='ui form']/div[7]/div[2]/div[1]", 10000); Days.Click(); Day.Click(); //Select start time GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[2]/input", 10000); StartTime.Click(); //enter start time StartTimeDropDown.Click(); //StartTimeDropDown.Clear(); StartTimeDropDown.SendKeys("08:00 AM");//(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Select end time GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[3]/input", 10000); EndTime.Click(); //Enter end time EndTimeDropDown.Click(); //EndTimeDropDown.Clear(); EndTimeDropDown.SendKeys("05:00 PM");// (GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); //Click on Skill trade option SkillTradeOption.Click(); //Add Skill exchange tag GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000); SkillExchange.Click(); SkillExchange.Clear(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Select option Active or Hidden GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); ActiveOption.Click(); HiddenOpt.Click(); //Click on save button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000); Save.Click(); } catch (Exception ex) { Assert.Fail("Test failed to enter Skill details", ex.Message); } }
internal void EditShareSkill() { GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\Rammy\Desktop\marsframework\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); GlobalDefinitions.wait(30); //Click on ShareSkill button ShareSkillButton.Click(); //Wait GlobalDefinitions.wait(30); //Enter data in Title textbox Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Title")); string TitleTextbox = Title.GetAttribute("Value"); if (TitleTextbox.Length == 0) { Assert.IsEmpty("Title"); } //Enter data in Description textbox Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Description")); Assert.That(Description.Text, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(3, "Description"))); CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Category")); CategoryDropDown.Click(); SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "SubCategory")); SubCategoryDropDown.Click(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Tags")); Tags.SendKeys(Keys.Enter); //Click on Hourly basis service or One-off service if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "Hourly basis service") { Hourlybasisservice.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "One-off service") { OneOffservice.Click(); } //Click on On-site or Online if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "On-site") { OnSite.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "Online") { Online.Click(); } //Wait GlobalDefinitions.wait(60); //Convert excel dateformat to C# - Enter data in Staredate string dateformat = "dd / MM / yyyy"; string sdate = GlobalDefinitions.ExcelLib.ReadData(3, "Startdate"); string newStartDate = DateTime.Parse(sdate).ToString(dateformat); StartDateDropDown.SendKeys(newStartDate); string StartDate = StartDateDropDown.GetAttribute("Value"); if (StartDate.Length == 0) { Assert.IsEmpty("Startdate"); } //Convert excel dateformat to C# - Enter data in Enddate string edate = GlobalDefinitions.ExcelLib.ReadData(3, "Enddate"); string newEndDate = DateTime.Parse(edate).ToString(dateformat); EndDateDropDown.SendKeys(newEndDate); string EndDate = EndDateDropDown.GetAttribute("Value"); if (EndDate.Length == 0) { Assert.IsEmpty("Enddate"); } //Wait GlobalDefinitions.wait(60); //Click on a day Days.Click(); //Convert excel timeformat to C# - enter data in Starttime string timeformat = "hh:mmtt"; string stime = GlobalDefinitions.ExcelLib.ReadData(3, "Starttime"); string newStartTime = DateTime.Parse(stime).ToString(timeformat); StartTimeDropDown.SendKeys(newStartTime); string Start = StartTimeDropDown.GetAttribute("Value"); if (Start.Length == 0) { Assert.IsEmpty("Starttime"); } //Convert excel timeformat to C# - enter data in Endtime string etime = GlobalDefinitions.ExcelLib.ReadData(3, "Endtime"); string newEndTime = DateTime.Parse(etime).ToString(timeformat); EndTimeDropDown.SendKeys(newEndTime); string End = EndTimeDropDown.GetAttribute("Value"); if (End.Length == 0) { Assert.IsEmpty("Endtime"); } //Click on Skill-exchange or Credit if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Skill-exchange") { SkillExchangeOption.Click(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Credit") { CreditOption.Click(); CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //Click on Active or Hidden ActiveOption.Click(); if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Active") { ActiveOption.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Hidden") { HiddenOption.Click(); } //Upload a file WorkSample.Click(); GlobalDefinitions.wait(20); string path = GlobalDefinitions.ExcelLib.ReadData(3, "WorkSample"); AutoItX.WinActivate("File Upload"); //Wait GlobalDefinitions.wait(60); AutoItX.Send(path); AutoItX.Send("{ENTER}"); Save.Click(); Assert.That(ManageTitle.Text, Is.EqualTo("Voice Actor")); }
internal void EnterShareSkill() {//GlobalDefinitions.WaitForElement(driver, By.,20) GlobalDefinitions.wait(10); GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //clcik on Shareskill button ShareSkillButton.Click(); //Click on Title text box Title.SendKeys(ExcelLib.ReadData(2, "Title")); //Enter Description in Title Description.SendKeys(ExcelLib.ReadData(2, "Description")); //CLick on dropdown CategoryDropDown.Click(); //Thread.Sleep(5000); //Selecting option from Categorydropdown SelectElement oselect = new SelectElement(SelectSubDropdown); oselect.SelectByText(ExcelLib.ReadData(2, "Category")); //Click on SubCategory SubCategoryDropDown.Click(); //Selecting option from SubCategorydropdown SelectElement subCategory = new SelectElement(SelectDropdown); subCategory.SelectByValue(ExcelLib.ReadData(2, "SubCategory")); //Enter Tags Tags.SendKeys(ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); //Select Service Type(Radio buttons) switch (ExcelLib.ReadData(2, "ServiceType")) { case "One-off service": OneOffType.Click(); break; case "Hourly basis service": HourlyType.Click(); break; } //Select Location Type (Radio buttons) switch (ExcelLib.ReadData(2, "LocationType")) { case "On-site": OnSiteLocationTypeOption.Click(); break; case "Online": OnlineLocationTypeOption.Click(); break; } GlobalDefinitions.WaitForElement(driver, By.XPath("//div[3]/div[2]/input[1]"), 10); //Select Start Date StartDateDropDown.Click(); Thread.Sleep(5000); StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate")); GlobalDefinitions.WaitForElement(driver, By.Name("endDate"), 10); //Select End Date EndDateDropDown.Click(); EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate")); //DayAvailability switch (ExcelLib.ReadData(2, "Selectday")) { case "Sun": Sunday.Click(); SundayTime.SendKeys(ExcelLib.ReadData(2, "Starttime")); SundayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime")); break; case "Mon": Monday.Click(); MondayTime.SendKeys(ExcelLib.ReadData(2, "Starttime")); MondayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime")); break; case "Tue": Tuesday.Click(); TuesdayTime.SendKeys(ExcelLib.ReadData(2, "Starttime")); TuesdayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime")); break; case "Wed": Wednesday.Click(); WednesdayTime.SendKeys(ExcelLib.ReadData(2, "Starttime")); WednesdayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime")); break; case "Thu": Thursday.Click(); ThursdayTime.SendKeys(ExcelLib.ReadData(2, "Starttime")); //MondayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime")); break; } //Select Skill Trade Radio buttons) switch (ExcelLib.ReadData(2, "SkillTrade")) { case "Skill-exchange": FirstSkillTradeOption.Click(); break; case "Credit": SecondkillTradeOption.Click(); break; } //Enter Skill-Exchange SkillExchange.SendKeys(ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Enter WorkSample //FileUpload.SendKeys(@"C:\Users\minty\OneDrive\Pictures\FIle1.txt"); GlobalDefinitions.WaitForElement(driver, By.XPath("//i[@Class = 'huge plus circle icon padding-25']"), 10); FileUpload.Click(); AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); Thread.Sleep(5000); autoIt.Send(@"C:\Users\minty\OneDrive\Pictures\Camera Roll\Garry.jpeg"); Thread.Sleep(5000); autoIt.Send("{ENTER}"); //Thread.Sleep(5000); ////WorkSample.Click(); //Select ACtive/Hidden Options ( Radio Buttons) switch (ExcelLib.ReadData(2, "Active")) { case "Active": ActiveOption.Click(); break; case "Hidden": HiddenOption.Click(); break; } //Click on Save Save.Click(); // Assert.IsTrue("Service Listing Saved Successfully".Exist, "OK"); }
//Add share skill details internal void EnterShareSkill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); try { //Click on Share skill button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Share Skill", 10000); ShareSkillButton.Click(); //Enter the Title in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "title", 10000); Title.Click(); Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter the Description in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "description", 10000); Description.Click(); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "categoryId", 10000); CategoryDropDown.Click(); new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "subcategoryId", 10000); SubCategoryDropDown.Click(); new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tag names in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='']", 10000); Tags.Click(); Tags.Clear(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); //Select service type GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000); ServiceTypeOptions.Click(); Servicetyp.Click(); //Select the Location Type GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); LocationTypeOption.Click(); LocationSel.Click(); //Add start date StartDateDropDown.Click(); // StartDateDropDown.Clear(); StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End date EndDateDropDown.Click(); //EndDateDropDown.Clear(); EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select available day GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//body/div/div/div[@id='service-listing-section']/div[@class='ui container']/div[@class='listing']/form[@class='ui form']/div[7]/div[2]/div[1]", 10000); Days.Click(); Mon.Click(); Tue.Click(); Wed.Click(); Thurs.Click(); //Select start time and enter the time GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[2]/input", 10000); StartTimeM.Click(); StartTimeDropDownM.Click(); StartTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[2]/input", 10000); StartTimeT.Click(); StartTimeDropDownT.Click(); StartTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[2]/input", 10000); StartTimeW.Click(); StartTimeDropDownW.Click(); StartTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[2]/input", 10000); StartTimeTh.Click(); StartTimeDropDownTh.Click(); StartTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); //Select end time from box GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[3]/input", 10000); EndTimeM.Click(); EndTimeDropDownM.Click(); EndTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[3]/input", 10000); EndTimeT.Click(); EndTimeDropDownT.Click(); EndTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[3]/input", 10000); EndTimeW.Click(); EndTimeDropDownW.Click(); EndTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[3]/input", 10000); EndTimeTh.Click(); EndTimeDropDownTh.Click(); EndTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); Thread.Sleep(1000); //Click on Skill trade option SkillTradeOption.Click(); //Add Skill exchange tag GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000); SkillExchange.Click(); SkillExchange.Clear(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Upload File FileUpload.Click(); AutoItX3 autoIt = new AutoItX3(); AutoItX.WinWait("Open", "File Upload", 1); autoIt.WinActivate("Open"); Thread.Sleep(2000); var SampleWorkPath = MarsResource.SampleWorkPath; autoIt.Send(Path.GetFullPath(SampleWorkPath)); Thread.Sleep(2000); autoIt.Send("{Enter}"); Thread.Sleep(2000); //Select option Active or Hidden GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); ActiveOption.Click(); HiddenOpt.Click(); //Click on save button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000); Save.Click(); } catch (Exception ex) { Assert.Fail("Test failed to enter Skill details", ex.Message); } }
internal void EnterShareSkill() { Global.GlobalDefinitions.ExcelLib.PopulateInCollection(AppDomain.CurrentDomain.BaseDirectory.Replace(@"MarsFramework\bin\Debug\", @"MarsFramework\ExcelData\TestDataShareSkill.xlsx"), "ShareSkill"); //wait for element to appear Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.LinkText("Share Skill"), (20)); //Click on the share skill button ShareSkillButton.Click(); //Click on the title field Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.Name("title"), (20)); Title.Click(); //Type on the title field Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Title")); //Click on the description Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.Name("description"), (20)); Description.Click(); //Type on the Description Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Description")); //Click on category dropdown CategoryDropDown.Click(); //Choose an option from category dropdown CategoryDropDown.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Category") + Keys.Enter); //Click on sub category SubCategoryDropDown.Click(); //Choose an option from subcategory dropdown SubCategoryDropDown.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "SubCategory") + Keys.Enter); //Click on Tags Field Tags.Click(); //Type on the Tags Field then press Enter Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Tags") + Keys.Enter); //Click and choose an option for Service type ServiceTypeOptions.Click(); //Click and Choose an option for location type LocationTypeOption.Click(); //click on a skill trade option skill exchange SkillTradeOptionSkillExchange.Click(); //Click on skill exchange SkillExchange.Click(); //Type and add a tag SkillExchange.SendKeys("Test tag" + Keys.Enter); //click on a skill trade option credit SkillTradeOptionCredit.Click(); //Click on credit amount CreditAmount.Click(); //type and add a credit amount CreditAmount.SendKeys("2" + Keys.Enter); //Click an option on Active ActiveOption.Click(); //Save the skill Save.Click(); Thread.Sleep(2000); }
internal void EditShareSkill() { //Populate the Excel sheet Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ShareSkill"); int excelRowToRead = 3; Title.Clear(); Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Title")); //Click on Description Description.Clear(); Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Description")); //Select A Category CategoryDropDown.Click(); String categoryValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Category"); IList <IWebElement> CategoriesDropDownList = CategoryDropDown.FindElements(By.XPath("//option")); int DpListCount = CategoriesDropDownList.Count; for (int i = 0; i < DpListCount; i++) { if (CategoriesDropDownList[i].Text == categoryValue) { CategoriesDropDownList[i].Click(); } } //Select Sub Category Thread.Sleep(1000); IWebElement SubCategorySelection = Global.GlobalDefinitions.driver.FindElement(By.Name("subcategoryId")); SubCategorySelection.Click(); String SubCategoryValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "SubCategory"); IList <IWebElement> SubCategoriesDropDownList = SubCategorySelection.FindElements(By.XPath("//option")); int SbDpListCount = SubCategoriesDropDownList.Count; for (int i = 0; i < SbDpListCount; i++) { if (SubCategoriesDropDownList[i].Text == SubCategoryValue) { SubCategoriesDropDownList[i].Click(); } } //Clear and Add Tags IWebElement tagsInputBox = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[4]/div[2]/div")); IList <IWebElement> RemoveButtons = tagsInputBox.FindElements(By.ClassName("ReactTags__remove")); foreach (IWebElement element in RemoveButtons) { element.Click(); } Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Tag")); Tags.SendKeys(Keys.Enter); //Select Service Type String ServiceType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Service Type"); if (ServiceType.Equals("Hourly basis Service")) { HourlyServiceType.Click(); } else if (ServiceType.Equals("One-off Service")) { OneOffServiceType.Click(); } //Select Location Type String LocatioType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Location Type"); if (LocatioType.Equals("On-site")) { OnSiteLocationType.Click(); } else if (OnSiteLocationType.Equals("Online")) { OnlineLocationType.Click(); } //Select Available Start Date IWebElement AvailableStartDateInput = AvailabilityForm.FindElement(By.Name("startDate")); AvailableStartDateInput.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableStartDate")); //Select Available End Date IWebElement AvailableEndDateInput = AvailabilityForm.FindElement(By.Name("endDate")); AvailableEndDateInput.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableEndDate")); String[] WeekDays = new String[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; //Cleared Selected Checkboxes IList <IWebElement> AvailableCheckBoxes = AvailabilityForm.FindElements(By.Name("Available")); foreach (IWebElement element in AvailableCheckBoxes) { if (element.Selected) { element.Click(); } } //Select Check boxes based on data String AvailableDaysValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableDays"); IList <String> AvailableDays = AvailableDaysValue.Split(','); for (int i = 0; i < WeekDays.Count(); i++) { if (AvailableDays.Contains(WeekDays[i])) { AvailableCheckBoxes[i].Click(); } } //Set Start times IList <IWebElement> AvailableStartTimeInputs = AvailabilityForm.FindElements(By.Name("StartTime")); String AvailableStartTimesValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableStartTimes"); IList <String> AvailableStartTimes = AvailableStartTimesValue.Split(','); for (int i = 0; i < AvailableStartTimes.Count(); i++) { IList <String> startTimeInfo = AvailableStartTimes[i].Split(':'); String startTimeDay = startTimeInfo[0]; String startTimeValue = startTimeInfo[1]; int indexOfDay = Array.IndexOf(WeekDays, startTimeDay); AvailableStartTimeInputs[indexOfDay].SendKeys(startTimeValue); } //Set End times IList <IWebElement> AvailableEndTimeInputs = AvailabilityForm.FindElements(By.Name("EndTime")); String AvailableEndTimesValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableEndTimes"); IList <String> AvailableEndTimes = AvailableEndTimesValue.Split(','); for (int i = 0; i < AvailableEndTimes.Count(); i++) { IList <String> endTimeInfo = AvailableEndTimes[i].Split(':'); String endTimeDay = endTimeInfo[0]; String endTimeValue = endTimeInfo[1]; int indexOfDay = Array.IndexOf(WeekDays, endTimeDay); AvailableEndTimeInputs[indexOfDay].SendKeys(endTimeValue); } //Select Skill Exchange Type String SkillTradeType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "SkillTradeType"); if (SkillTradeType.Equals("Skill-exchange")) { SkillExchangeType.Click(); //Clear and Add Tags IWebElement SkillTagsInputBox = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div")); IList <IWebElement> CrossButtons = SkillTagsInputBox.FindElements(By.ClassName("ReactTags__remove")); foreach (IWebElement element in CrossButtons) { element.Click(); } SkillExchangeTag.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "SkillExchangeTab")); SkillExchangeTag.SendKeys(Keys.Enter); } else if (SkillTradeType.Equals("Credit")) { CreditsType.Click(); CreditAmount.Clear(); CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "CreditsAmount")); } //Select Active Status Button String ActiveType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "ActiveType"); if (SkillTradeType.Equals("Active")) { ActiveButton.Click(); } else if (SkillTradeType.Equals("Hidden")) { HiddenButton.Click(); } //Click on Save Button SaveButton.Click(); Thread.Sleep(3000); //Verify IWebElement listingTable = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table")); IList <IWebElement> tableRows = listingTable.FindElements(By.TagName("tr")); Boolean isListingEdited = false; for (int i = 0; i <= tableRows.Count; i++) { IWebElement row = tableRows[i]; if (row.Text.Contains(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Title")) && row.Text.Contains(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Description"))) { isListingEdited = true; break; } } if (isListingEdited == true) { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Edit Skill test Successful"); } else { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Edit Skill test Failed"); } }
//Add share skill details internal void EnterShareSkill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); try { ShareSkillButton.Click(); //Click on Share skill button // GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//a[contains(text(),'Share Skill')]", 10000); // ShareSkillButton.Click(); //Enter the Title in textbox //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='title']", 10000); Title.Click(); Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter the Description in textbox //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='description']", 10000); GlobalDefinitions.wait(1500); Description.Click(); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select catagory from drop down //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='categoryId']", 10000); CategoryDropDown.Click(); new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select catagory from drop down //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='subcategoryId']", 10000); SubCategoryDropDown.Click(); new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tag names in textbox // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@value='']", 10000); Tags.Click(); Tags.Clear(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); //Select service type // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000); ServiceTypeOptions.Click(); Servicetyp.Click(); //Select the Location Type GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "(//input[@name='locationType'])[1]", 10000); LocationTypeOption.Click(); LocationSel.Click(); //Add start date StartDateDropDown.Click(); // StartDateDropDown.Clear(); StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End date EndDateDropDown.Click(); //EndDateDropDown.Clear(); EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); EndDateDropDown.SendKeys(Keys.Enter); GlobalDefinitions.SelectDayTime(GlobalDefinitions.driver, (GlobalDefinitions.ExcelLib.ReadData(2, "Day")), Sun, Mon, Tue, Wed, Thu, Fri, Sat); /* * //Select available day * GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//body/div/div/div[@id='service-listing-section']/div[@class='ui container']/div[@class='listing']/form[@class='ui form']/div[7]/div[2]/div[1]", 10000); * Days.Click(); * Day.Click(); * * //Select start time * GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[2]/input", 10000); * StartTime.Click(); * * * //enter start time * StartTimeDropDown.Click(); * //StartTimeDropDown.Clear(); * StartTimeDropDown.SendKeys((GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"))); * * //Select end time * GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[3]/input", 10000); * EndTime.Click(); * * //Enter end time * EndTimeDropDown.Click(); * //EndTimeDropDown.Clear(); * EndTimeDropDown.SendKeys("05:00 PM");// (GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); */ //Click on Skill trade option SkillTradeOption.Click(); //Add Skill exchange tag // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000); SkillExctxtbx.Clear(); SkillExctxtbx.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExctxtbx.SendKeys(Keys.Enter); //Select option Active or Hidden // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); //((GlobalDefinitions.ExcelLib.ReadData(2, "SkillActiveOptions")); //ActiveOption.Click(); HiddenOption.Click(); //Click on save button GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000); Save.Click(); } catch (Exception ex) { Assert.Fail("Test failed to enter Skill details", ex.Message); } }
//Add share skill details internal void EnterShareSkill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); try { #region Navigate to Share Skills Page //Click on Share skill button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Share Skill", 10000); ShareSkillButton.Click(); #endregion #region Enter Title //Enter the Title in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "title", 10000); Title.Click(); Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); #endregion #region Enter Description //Enter the Description in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "description", 10000); Description.Click(); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); #endregion #region Category Drop Down //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "categoryId", 10000); CategoryDropDown.Click(); new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "subcategoryId", 10000); SubCategoryDropDown.Click(); new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); #endregion #region Tags //Enter Tag names in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='']", 10000); Tags.Click(); Tags.Clear(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); #endregion #region Service Type Selection //Select service type if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000); ServiceTypeOptions.Click(); ServicetypeHourly.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000); ServiceTypeOptions.Click(); ServicetypeOneOff.Click(); } #endregion #region Select Location Type //Select the Location Type if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "On-site") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); LocationTypeOption.Click(); LocationSelOnsite.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "Online") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); LocationTypeOption.Click(); LocationSelOnline.Click(); } #endregion #region Select Available Dates from Calendar //Add start date StartDateDropDown.Click(); // StartDateDropDown.Clear(); StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End date EndDateDropDown.Click(); //EndDateDropDown.Clear(); EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select available days GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//body/div/div/div[@id='service-listing-section']/div[@class='ui container']/div[@class='listing']/form[@class='ui form']/div[7]/div[2]/div[1]", 10000); Days.Click(); Mon.Click(); Tue.Click(); Wed.Click(); Thurs.Click(); //Select start time and enter the time GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[2]/input", 10000); StartTimeM.Click(); StartTimeDropDownM.Click(); StartTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[2]/input", 10000); StartTimeT.Click(); StartTimeDropDownT.Click(); StartTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[2]/input", 10000); StartTimeW.Click(); StartTimeDropDownW.Click(); StartTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[2]/input", 10000); StartTimeTh.Click(); StartTimeDropDownTh.Click(); StartTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); //Select end time from box GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[3]/input", 10000); EndTimeM.Click(); EndTimeDropDownM.Click(); EndTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[3]/input", 10000); EndTimeT.Click(); EndTimeDropDownT.Click(); EndTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[3]/input", 10000); EndTimeW.Click(); EndTimeDropDownW.Click(); EndTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[3]/input", 10000); EndTimeTh.Click(); EndTimeDropDownTh.Click(); EndTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); Thread.Sleep(1000); #endregion #region Select Skill Trade //Click on Skill trade option if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Skill-Exchange") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[8]/div[@class='twelve wide column']/div/div[@class='field']", 10000); SkillTradeOption.Click(); //Add Skill exchange tag GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000); SkillExchange.Click(); SkillExchange.Clear(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Credit") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[8]/div[@class='twelve wide column']/div/div[@class='field']", 10000); SkillTradeOption.Click(); CreditBtn.Click(); //Addcredit amount GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/input", 10000); CreditAmount.Click(); CreditAmount.Clear(); CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange")); CreditAmount.SendKeys(Keys.Enter); } #endregion #region Add Work Sample FileUpload.Click(); AutoItX3 autoIt = new AutoItX3(); AutoItX.WinWait("Open", "File Upload", 1); autoIt.WinActivate("Open"); Thread.Sleep(2000); var SampleWorkPath = MarsResource.SampleWorkPath; autoIt.Send(Path.GetFullPath(SampleWorkPath)); Thread.Sleep(2000); autoIt.Send("{Enter}"); Thread.Sleep(2000); #endregion #region Select User Status //Select option Active or Hidden if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); ActiveOption.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); ActiveOption.Click(); HiddenOpt.Click(); } #endregion #region Save / Cancel Skill // Save or Cancel New Skill if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000); Save.Click(); } else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel") { Cancel.Click(); } #endregion } catch (Exception ex) { Assert.Fail("Test failed to enter Skill details", ex.Message); } }