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() { GlobalDefinitions.waitClickableElement(GlobalDefinitions.driver, "XPath", "//div[@class = 'right item']/a"); //Enter title GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\marsframework\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select category from the dropdown SelectElement cd = new SelectElement(CategoryDropDown); cd.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select subcategory from the dropdown SelectElement scd = new SelectElement(SubCategoryDropDown); scd.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Send data in tag field and press enter Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); //Select service type radiobutton ServiceTypeOptions.Click(); //Select Location type radiobutton LocationTypeOption.Click(); //Select Start Date DropDown StartDateDropDown.Click(); //Enter end date EndDateDropDown.SendKeys("09082020"); //Click on days Days.Click(); //Select start time StartTime.Click(); StartTimeDropDown.SendKeys("1024PM"); //Select end time EndTimeDropDown.SendKeys("1126PM"); //Select SkillTradeOption radiobutton SkillTradeOption.Click(); //Send data in SkillExchange and press enter SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Select active radiobutton ActiveOption.Click(); //Click on Save button Save.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 EnterShareSkill() { //Click on Share Skill button DefaultWait <IWebDriver> fluentWait = new DefaultWait <IWebDriver>(GlobalDefinitions.driver); fluentWait.Timeout = TimeSpan.FromSeconds(60); fluentWait.PollingInterval = TimeSpan.FromSeconds(3); /* Ignore the exception - NoSuchElementException that indicates that the element is not present */ fluentWait.IgnoreExceptionTypes(typeof(NoSuchElementException)); fluentWait.Message = "Element to be searched not found"; GlobalDefinitions.driver.FindElement(By.XPath("//a[@href = '/Home/ServiceListing']")).Click(); Global.GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\marsframework\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); //Enter title Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter description Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select category from the dropdown SelectElement cd = new SelectElement(CategoryDropDown); cd.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select subcategory from the dropdown SelectElement scd = new SelectElement(SubCategoryDropDown); scd.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Send data in tag field and press enter Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); //Select service type radiobutton ServiceTypeOptions.Click(); //Select Location type radiobutton LocationTypeOption.Click(); //Select Start Date DropDown StartDateDropDown.Click(); //Enter end date EndDateDropDown.SendKeys("09082020"); //Click on days Days.Click(); //Select start time StartTime.Click(); StartTimeDropDown.SendKeys("1024PM"); //Select end time EndTimeDropDown.SendKeys("1126PM"); //Select SkillTradeOption radiobutton SkillTradeOption.Click(); //Send data in SkillExchange and press enter SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Click on Worksample and upload the image IWebElement worksample = Global.GlobalDefinitions.driver.FindElement(By.CssSelector("i.huge.plus.circle.icon.padding-25")); worksample.Click(); Thread.Sleep(30000); { var procStartInfo = new System.Diagnostics.ProcessStartInfo(@"C:\marsframework\FileUpload1.exe"); var proc = new System.Diagnostics.Process { StartInfo = procStartInfo }; proc.Start(); proc.WaitForExit(1000); //proc.Kill(); if (proc.HasExited) { //Select active radiobutton ActiveOption.Click(); //Click on Save button Save.Click(); } } }