internal void InputCategory(int dataRow) { CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); }
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 EnterShareSkill() { //Pouplate ShareSkill Data into ExcelReader GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //Enter the data on HTML form Title.EnterText(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); GlobalDefinitions.wait(10); Description.EnterText(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); GlobalDefinitions.wait(10); //Select Category and Subcategory CategoryDropDown.selectDropDown(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); GlobalDefinitions.wait(10); SubCategoryDropDown.selectDropDown(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); GlobalDefinitions.wait(10); //Enter tag Tags.EnterText(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.EnterText(Keys.Enter); GlobalDefinitions.wait(10); //Select Radio button selectServiceRadioButton(ServiceTypeOptions, GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType")); GlobalDefinitions.wait(10); selectLocationRadioButton(LocationTypeOptions, GlobalDefinitions.ExcelLib.ReadData(2, "LocationType")); GlobalDefinitions.wait(10); // select start and end data and time //selectStartDateAndTime(); GlobalDefinitions.wait(20); // select skill trade: Skill exchange or credit selectSkillTrade(SkillTradeOption, GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); GlobalDefinitions.wait(10); // Upload work sample.docx fileUpload.Click(); GlobalDefinitions.FileUpload.uploadFileUsingAutoIT(@MarsResource.FileUpload); GlobalDefinitions.wait(20); // select Active Radio button: Active or Hidden selectActiveRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active")); }
internal void EnterShareSkill() { //Extension custom method //Click on Share skill tab ShareSkillButton.Clicks(); Title.EnterText("Selenium"); Description.EnterText("Would you like to provide Selenium training?"); //Select dropbox CategoryDropDown.SelectFromDDL("Programming & Tech"); SubCategoryDropDown.SelectFromDDL("Databases"); //Enter value in tag Tags.EnterText("Testing"); //Enter Key Tags.SendKeys(Keys.Enter); Thread.Sleep(1000); //Select Service Type ServiceTypeOptions.Click(); //Select Location Type LocationTypeOption.Click(); Thread.Sleep(1000); //Enter Skill Trade SkillTrade.Click(); Thread.Sleep(1000); // GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='skillTrades'][@tabindex='0'][@value='false']")).Clicks(); //hidden credit AddCredit.Click(); AddCredit.SendKeys(("10")); ActiveStatus.Click(); Thread.Sleep(1000); //Save Button SaveButton1.Clicks(); }
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 EditShareSkill(string title, string desc, string cat, string subCat, string tag, string serviceType, string locType, //string Sdate, string Edate, //string StartTime, string EndTime, string Skilltrade, string SkillExchangeTag, string credit, string active) { Title.EnterText(title); Description.EnterText(desc); //Select dropbox CategoryDropDown.SelectFromDDL(cat); SubCategoryDropDown.SelectFromDDL(subCat); //Enter value in tag Tags.EnterText(tag); //Enter Key Tags.SendKeys(Keys.Enter); //check Tag entered Assert.IsNotNull(Tags, "Test fail- Tag Empty"); //Enter Service Type if (serviceType == "Hourly basis service") { GlobalDefinitions.driver.FindElement(By.XPath("//label[contains(.,'Hourly basis service')]")).Clicks(); } else if (serviceType == "One-off service") { GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='serviceType'][@type='radio'][@value='1']")).Clicks(); } //Enter Location Type if (locType == "On-site") { GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='locationType'][@value='0']")).Clicks(); } else if (locType == "Online") { GlobalDefinitions.driver.FindElement(By.XPath("(//input[contains(@name,'locationType')])[1]")).Clicks(); } ////Enter Start date // GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='startDate']")).EnterText(Sdate); ////Enter End Date //GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='endDate']")).EnterText(Edate); ////Select the days and time //GlobalDefinitions.driver.FindElement(By.XPath("//inpu" + // "t[@tabindex='0'][@index='0'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[1]")).EnterText(StartTime); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[1]")).EnterText(EndTime); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='1'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[2]")).EnterText(StartTime); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[2]")).EnterText(EndTime); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='2'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[3]")).EnterText(StartTime); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[3]")).EnterText(EndTime); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='3'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[4]")).EnterText(StartTime); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[4]")).EnterText(EndTime); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='4'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[5]")).EnterText(StartTime); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[5]")).EnterText(EndTime); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='5'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[6]")).EnterText(StartTime); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[6]")).EnterText(EndTime); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='6'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[7]")).EnterText(StartTime); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[7]")).EnterText(EndTime); //Enter Skill Trade if (Skilltrade == "Skill-Exchange") { GlobalDefinitions.driver.FindElement(By.XPath("//label[contains(.,'Skill-exchange')]")).Clicks(); } else if (Skilltrade == "Credit") { GlobalDefinitions.driver.FindElement(By.XPath("//label[contains(.,'Credit')]")).Clicks(); } //Enter Skill Exchange Tag SkillExchange.EnterText(SkillExchangeTag); SkillExchange.SendKeys(Keys.Enter); //Check Tag entered Assert.IsNotNull(SkillExchange, "Test fail- SkillExchange Tag is Empty"); //hidden credit //GlobalDefinitions.driver.FindElement(By.XPath("GlobalDefinitions.driver.FindElement(By.XPath")).EnterText("9"); //Work Sample using Sendkey IWebElement ws = GlobalDefinitions.driver.FindElement(By.XPath("//i[@class='huge plus circle icon padding-25']")); ws.Clicks(); //using AutoIT upload file AutoItX.WinWaitActive("Open"); AutoItX.Send(@"C:\Mars\Test error.txt"); AutoItX.Sleep(5); AutoItX.Send("{ENTER}"); //check file is upload or not //IWebElement file = GlobalDefinitions.driver.FindElement(By.XPath("//span[@class='tooltiptext']")); //Assert.That(file.Text != null, "File uploaded Fail"); try { IWebElement file = GlobalDefinitions.driver.FindElement(By.XPath("//span[@class='tooltiptext']")); Assert.That(file.Text != null, "File uploaded Fail"); } catch (NoSuchElementException) { Assert.Fail("File Uploaded Fail"); } //Click Hiddden Bullet if (active == "Active") { GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='isActive'][@value='false']")).Clicks(); } else { GlobalDefinitions.driver.FindElement(By.XPath("(//input[contains(@name,'isActive')])[2]")).Clicks(); } //Save Button Save.Clicks(); }
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"); }
public void Listings() { GlobalDefinitions.Wait(); ManageListingsLink.Click(); //Checking the right page Assert.AreEqual("ListingManagement", GlobalDefinitions.driver.Title); Base.test = Base.extent.StartTest("On Share Manage Listing page"); edit.Click(); //Populate the Excel Sheet Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); Title.SendKeys(ExcelLib.ReadData(3, "Title")); GenericMethods.CheckLength(4, 100, ExcelLib.ReadData(3, "Title"), "Title"); Description.SendKeys(ExcelLib.ReadData(3, "Description")); GenericMethods.CheckLength(4, 600, ExcelLib.ReadData(3, "Description"), "Description"); CategoryDropDown.SendKeys(ExcelLib.ReadData(3, "Category")); SubCategoryDropDown.SendKeys(ExcelLib.ReadData(3, "SubCategory")); TxtTags.SendKeys(ExcelLib.ReadData(3, "Tags")); TxtTags.SendKeys(Keys.Enter); IWebElement ServiceTypeOptions = GlobalDefinitions.driver.FindElement(By.XPath("//div[5]//div[2]//div[1]//div[2]//div[1]//input[1]")); ServiceTypeOptions.Click(); IWebElement LocationTypeOption = GlobalDefinitions.driver.FindElement(By.XPath("//div[6]//div[2]//div[1]//div[2]//div[1]//input[1]")); LocationTypeOption.Click(); StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate")); EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate")); for (int i = 2; i < 9; i++) { for (int j = 2; j < 9; j++) { IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input")); IWebElement EndTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input")); if (i == 2 && j == 2) { GlobalDefinitions.driver.FindElement(By.XPath("//div[contains(@class,'twelve wide column')]//div[2]//div[1]//div[1]//input[1]")).Click(); StartTime.SendKeys("0230PM"); StartTime.SendKeys(Keys.Tab); EndTime.SendKeys("3052PM"); } if (i == 3 && j == 3) { GlobalDefinitions.driver.FindElement(By.XPath("//div[3]//div[1]//div[1]//input[1]")).Click(); StartTime.SendKeys("0530PM"); EndTime.SendKeys("0856PM"); } } } IWebElement credit = GlobalDefinitions.driver.FindElement(By.XPath("//div[8]//div[2]//div[1]//div[2]//div[1]//input[1]")); if (!credit.Selected) { credit.Click(); CreditAmount.SendKeys("9"); } WorkSample.Click(); AutoItX3 autoIt = new AutoItX3(); autoIt.WinWait("Open", "File Upload", 1); autoIt.WinActivate("Open", "File Upload"); autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]"); autoIt.Send(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..")) + "\\Test.txt"); //autoIt autoIt.Send("{ENTER}"); autoIt.Sleep(1000); IWebElement ActiveOption = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']")); ActiveOption.Click(); GlobalDefinitions.Wait(); Save.Click(); GlobalDefinitions.Wait(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills edited succesfully"); string searchInput1 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[2]")).Text; Assert.AreEqual(searchInput1, ExcelLib.ReadData(3, "Category")); string searchInput2 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[3]")).Text; Assert.AreEqual(searchInput2, ExcelLib.ReadData(3, "Title")); string searchInput3 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[5]")).Text; Assert.AreEqual(searchInput3, ExcelLib.ReadData(3, "ServiceType")); }
public void EnterShareSkill() { GlobalDefinitions.Wait(); ShareSkillButton.Click(); //Checking the right page Assert.AreEqual("ServiceListing", GlobalDefinitions.driver.Title); Base.test = Base.extent.StartTest("On Share Skill page"); //Populate the Excel Sheet Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //Enter TITLE Title.SendKeys(ExcelLib.ReadData(2, "Title")); //Check Length of Title GenericMethods.CheckLength(4, 100, ExcelLib.ReadData(2, "Title"), "Title"); //Enter Description Description.SendKeys(ExcelLib.ReadData(2, "Description")); GenericMethods.CheckLength(4, 600, ExcelLib.ReadData(2, "Description"), "Description"); //Select Category form dropdown CategoryDropDown.SendKeys(ExcelLib.ReadData(2, "Category")); SubCategoryDropDown.SendKeys(ExcelLib.ReadData(2, "SubCategory")); //Enter tag TxtTags.SendKeys(ExcelLib.ReadData(2, "Tags")); TxtTags.SendKeys(Keys.Enter); //Select service Type IWebElement ServiceTypeOptions = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']")); ServiceTypeOptions.Click(); //Select Location Type IWebElement LocationTypeOption = GlobalDefinitions.driver.FindElement(By.XPath("//div[6]//div[2]//div[1]//div[1]//div[1]//input[1]")); LocationTypeOption.Click(); //Enter start Date and End date StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate")); EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate")); // Loop for no. of days available,Start time and End time for (int i = 2; i < 9; i++) { for (int j = 2; j < 9; j++) { IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input")); IWebElement EndTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input")); if (i == 2 && j == 2) { GlobalDefinitions.driver.FindElement(By.XPath("//div[contains(@class,'twelve wide column')]//div[2]//div[1]//div[1]//input[1]")).Click(); StartTime.SendKeys("0230PM"); StartTime.SendKeys(Keys.Tab); EndTime.SendKeys("3052PM"); } if (i == 3 && j == 3) { GlobalDefinitions.driver.FindElement(By.XPath("//div[3]//div[1]//div[1]//input[1]")).Click(); StartTime.SendKeys("0530PM"); EndTime.SendKeys("0856PM"); } } } // Select Skill Trade IWebElement credit = GlobalDefinitions.driver.FindElement(By.XPath("//div[8]//div[2]//div[1]//div[2]//div[1]//input[1]")); //Checking if the radio is selected or not if (!SkillTradeOption.Selected) { SkillTradeOption.Click(); } Boolean status = GlobalDefinitions.driver.FindElement(By.XPath("//input[@type='radio']")).Selected; //To Check Radiobutton is selected or not if (status) { Console.WriteLine("RadioButton is checked"); } else { Console.WriteLine("RadioButton is unchecked"); } //Enter SkillExchange SkillExchange.SendKeys(ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Upload File Using Auto IT WorkSample.Click(); AutoItX3 autoIt = new AutoItX3(); autoIt.WinWait("Open", "File Upload", 1); autoIt.WinActivate("Open", "File Upload"); autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]"); autoIt.Send(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..")) + "\\Test.txt"); autoIt.Sleep(1000); autoIt.Send("{ENTER}"); // autoIt.Sleep(1000); //Select Active Type IWebElement ActiveOption = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']")); ActiveOption.Click(); GlobalDefinitions.Wait(); Save.Click(); GlobalDefinitions.Wait(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills Added Successfully"); //Assert.AreEqual("ServiceListing", GlobalDefinitions.driver.Title); //Assert on category / title / Service Type after adding the skill and displayed on Manage Listing Page string searchInput1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Programming & Tech')]")).Text; Console.WriteLine(searchInput1); Assert.AreEqual(searchInput1, ExcelLib.ReadData(2, "Category")); string searchInput2 = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']//tbody//tr[1]//td[3]")).Text; Console.WriteLine(searchInput2); Assert.AreEqual(searchInput2, ExcelLib.ReadData(2, "Title").TrimEnd()); //string searchInput3 = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']//tbody//tr[1]//td[5]")).Text; //Assert.AreEqual(searchInput3, ExcelLib.ReadData(2, "ServiceType")); }
internal void EnterShareSkill1() { Global.GlobalDefinitions.wait(60000); ShareSkillButton.Click(); //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //********************************** //Enter the Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Title has been successfully entered"); //******************************************** //Enter the Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Description has been successfully entered"); //****************************************** //Select the Category option Actions action = new Actions(GlobalDefinitions.driver); action.MoveToElement(CategoryDropDown).Build().Perform(); System.Collections.Generic.IList <IWebElement> ServiceCategory = CategoryDropDown.FindElements(By.TagName("option")); int count = ServiceCategory.Count; Console.WriteLine("Number of Category : " + count); for (int i = 0; i < count; i++) { if (ServiceCategory[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category")) { ServiceCategory[i].Click(); Base.test.Log(LogStatus.Info, "Category has been successfully selected"); break; } } //**************************************** //Select the subcategory action.MoveToElement(SubCategoryDropDown).Build().Perform(); IList <IWebElement> SubCategory = SubCategoryDropDown.FindElements(By.TagName("option")); int subcategorycount = SubCategory.Count; Console.WriteLine("Number of Sub Category : " + subcategorycount); for (int i = 0; i < subcategorycount; i++) { if (SubCategory[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")) { SubCategory[i].Click(); Base.test.Log(LogStatus.Info, "Sub Category has been successfully selected"); break; } } //************************************** //Enter Tag name Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); Base.test.Log(LogStatus.Pass, "Tag name has been succesfully enetered"); //************************************ //Service Type Option action.MoveToElement(ServiceTypeOptions).Build().Perform(); Thread.Sleep(3000); // Storing all the elements under category of 'Service Type' in the list of WebLements IList <IWebElement> ServiceType = ServiceTypeOptions.FindElements(By.XPath("//div/input[@name='serviceType']")); //Indicating the number of buttons present int servicetypecount = ServiceType.Count; Console.WriteLine("Number of Service type : " + servicetypecount); for (int i = 0; i < servicetypecount; i++) { //Storing the radio button to the string variable "Value", using the "value" attribute string Value = ServiceType.ElementAt(i).GetAttribute("value"); int j = i + 1; var Name = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[" + j + "]/div/label")).Text; //Checking if Name equals the "name" attribute - "ServiceType" if (Name.Equals(ExcelLib.ReadData(2, "ServiceType")) && Value.Equals("" + i)) { ServiceType.ElementAt(i).Click(); Base.test.Log(LogStatus.Pass, "Service Type has been succesfully selected"); break; } } //***************************************** //Location Type Option action.MoveToElement(LocationTypeOption).Build().Perform(); Thread.Sleep(3000); // Storing all the elements under category of 'Location Type' in the list of WebLements IList <IWebElement> LocationType = LocationTypeOption.FindElements(By.XPath("//div/input[@name='locationType']")); //Indicating the number of buttons present int locationtypecount = LocationType.Count; Console.WriteLine("Number of Location type : " + locationtypecount); for (int i = 0; i < locationtypecount; i++) { //Storing the radio button to the string variable "Value", using the "value" attribute string Value = LocationType.ElementAt(i).GetAttribute("value"); int j = i + 1; var Name = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div[1]/div[" + j + "]/div/label")).Text; //Checking if Name equals the "name" attribute - "LocationType" if (Name.Equals(ExcelLib.ReadData(2, "LocationType")) && Value.Equals("" + i)) { LocationType.ElementAt(i).Click(); Base.test.Log(LogStatus.Pass, "Location Type has been succesfully selected"); break; } } //****************************************** //Entering start date StartDateDropDown.SendKeys(Keys.Delete); Console.WriteLine("Start date read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //1st Method using DateTime Class //==================================== var dateTime = GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"); Console.WriteLine("Date is : " + dateTime); /*DateTime parsedDate = DateTime.Parse(dateTime); * Console.WriteLine("Parsed Date is : " + parsedDate); * //var dateTimeNow = DateTime.Now; /C:\Users\Vidhya\source\repos\MarsFramework\MarsFramework\packages\WebDriver.ChromeDriver.win32.2.41.0\content\chromedriver.exe/ Return 00/00/0000 00:00:00 * //Console.WriteLine("Date Time Now : " + dateTimeNow); * //var dateOnlyString = dateTimeNow.ToShortDateString(); //Return 00/00/0000 * //Console.WriteLine("Date only string is : " + dateOnlyString); * var dateOnlyString = parsedDate.ToShortDateString(); //To convert string to DateTime format Return 00/00/0000 00:00:00 * Console.WriteLine("Date only string is : " + dateOnlyString); * StartDateDropDown.SendKeys(dateOnlyString);*/ //2nd Method using string split //============================== string[] splitDate = dateTime.Split(' '); int countSplitDate = splitDate.Count(); Console.WriteLine("The count of date string is : " + countSplitDate); Console.WriteLine($"String 1 is : {splitDate[0]} "); Console.WriteLine($"String 2 is : {splitDate[1]} "); Console.WriteLine($"String 3 is : {splitDate[2]} "); StartDateDropDown.SendKeys(splitDate[0]); StartDateDropDown.SendKeys(Keys.Tab); Base.test.Log(LogStatus.Pass, "Start Date has succesfully been edited"); //****************************************** //Entering End date //Console.Out.Write("End Date read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); Console.WriteLine("End Date read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //var endDate = GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"); //DateTime parsedEndDate = DateTime.Parse(endDate); //var endDateonly = parsedEndDate.ToShortDateString(); //EndDateDropDown.SendKeys(endDateonly); EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); EndDateDropDown.SendKeys(Keys.Tab); Base.test.Log(LogStatus.Pass, "End Date has succesfully been edited"); //*************************************** //Selecting the day action.MoveToElement(Days).Build().Perform(); IList <IWebElement> allDays = Days.FindElements(By.XPath("//div/div/div/input[@name = 'Available']")); int allDaysCount = allDays.Count; Console.WriteLine("Number of Days : " + allDaysCount); for (int i = 0; i < allDaysCount; i++) { int j = i + 2; var day = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[1]/div[1]/label")).Text; if (day.Equals(ExcelLib.ReadData(2, "Selectday"))) { allDays.ElementAt(i).Click(); Base.test.Log(LogStatus.Pass, "Day has been succesfully selected"); break; } } //***************************************** //Entering the starttime Console.WriteLine("Start time read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); var startTime = GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"); DateTime parsedStartTime = DateTime.Parse(startTime); var startTimeString = parsedStartTime.ToString("hh:mmtt"); //var startTimeString = parsedStartTime.ToShortTimeString(); Console.WriteLine("Start Time String is : " + startTimeString); StartTimeDropDown.SendKeys(startTimeString); StartTimeDropDown.SendKeys(Keys.Tab); //***************************************** //Entering the endtime GlobalDefinitions.wait(5); Console.WriteLine("End time read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); var endTime = GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"); DateTime parsedEndTime = DateTime.Parse(endTime); var endTimeString = parsedEndTime.ToString("hh:mmtt"); Console.WriteLine("End Time String is : " + endTimeString); EndTimeDropDown.SendKeys(endTimeString); //****************************************** //Skill Trade Option action.MoveToElement(SkillTradeOption).Build().Perform(); // Storing all the elements under category of 'Skill Trade' in the list of WebLements IList <IWebElement> SkillTrade = SkillTradeOption.FindElements(By.XPath("//div/input[@name='skillTrades']")); //Indicating the number of buttons present int skilltradecount = SkillTrade.Count; Console.WriteLine("Number of Skill Trade : " + skilltradecount); for (int i = 0; i < skilltradecount; i++) { //Storing the radio button to the string variable "Value", using the "value" attribute string Value = SkillTrade.ElementAt(i).GetAttribute("value"); int j = i + 1; var Name = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[2]/div[1]/div[" + j + "]/div/label")).Text; //Checking if Name equals the "name" attribute - "LocationType" if (Name.Equals(ExcelLib.ReadData(2, "SkillTrade")) && Value.Equals("" + i)) { SkillTrade.ElementAt(i).Click(); Base.test.Log(LogStatus.Pass, "Skill Trade has been succesfully selected"); break; } } //**************************************** //Enter Skill-Exchange Tag name SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); Base.test.Log(LogStatus.Pass, "Skill-Exchange Tag name has been succesfully enetered"); //************************************** //Active Option action.MoveToElement(ActiveOption).Build().Perform(); Thread.Sleep(3000); // Storing all the elements under category of 'Active' in the list of WebLements IList <IWebElement> Active = ActiveOption.FindElements(By.XPath("//div/input[@name='isActive']")); //Indicating the number of buttons present int activecount = Active.Count; Console.WriteLine("Number of Active : " + activecount); for (int i = 0; i < activecount; i++) { //Storing the radio button to the string variable "Value", using the "value" attribute string Value = Active.ElementAt(i).GetAttribute("value"); int j = i + 1; var Name = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[10]/div[2]/div[1]/div[" + j + "]/div/label")).Text; //Checking if Name equals the "name" attribute - "Active Option" if (Name.Equals(ExcelLib.ReadData(2, "Active")))// && Value.Equals("" + i)) { Active.ElementAt(i).Click(); Base.test.Log(LogStatus.Pass, "Services option has been succesfully selected"); break; } } //************************************ //Save the page Save.Click(); }
internal void EnterShareSkill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathShareSkill, "ShareSkill"); //Waiting for Profile page to load GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.LinkText("Share Skill"), 10); //Click on Share Skill button ShareSkillButton.Click(); //Waiting for Share Skill page to load GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.Name("title"), 10); //Enter Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title") + TimeStamp); //Enter Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category from DropDown CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select SubCategory from DropDown SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + Keys.Enter); //Select ServiceType from Option switch ((GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"))) { case "Hourly basis service": //Select Hourly basis service from options ServiceTypeOptions[0].Click(); break; case "One-off service": //Select One-off service from options ServiceTypeOptions[1].Click(); break; } //Select LocationType from Option switch ((GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"))) { case "On-site": //Select On-site from location options LocationTypeOption[0].Click(); break; case "Online": //Select Online from location options LocationTypeOption[1].Click(); break; } //Enter StartDate from DropDown StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Enter EndDate from DropDown EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select Days and enter Start and End time if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Sun") { //Select Sunday Days[0].Click(); //Enter StartTime from DropDown StartTimeDropDown[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Enter EndTime from DropDown EndTimeDropDown[0].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); } else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Mon") { //Select Monday Days[1].Click(); //Enter StartTime from DropDown StartTimeDropDown[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Enter EndTime from DropDown EndTimeDropDown[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); } else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Tue") { //Select Tuesday Days[2].Click(); //Enter StartTime from DropDown StartTimeDropDown[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Enter EndTime from DropDown EndTimeDropDown[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); } else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Wed") { //Select Wednesday Days[3].Click(); //Enter StartTime from DropDown StartTimeDropDown[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Enter EndTime from DropDown EndTimeDropDown[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); } else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Thu") { //Select Thursday Days[4].Click(); //Enter StartTime from DropDown StartTimeDropDown[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Enter EndTime from DropDown EndTimeDropDown[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); } else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Fri") { //Select Friday Days[5].Click(); //Enter StartTime from DropDown StartTimeDropDown[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Enter EndTime from DropDown EndTimeDropDown[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); } else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Sat") { //Select Saturday Days[6].Click(); //Enter StartTime from DropDown StartTimeDropDown[7].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //Enter EndTime from DropDown EndTimeDropDown[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); } //Select Skill Trade from options if ((GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade")) == "Skill-Exchange") { //Select Skill-exchange from available options SkillTradeOption[0].Click(); //Enter SkillExchange SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + Keys.Enter); } else if ((GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade")) == "Credit") { //Select Credit from available options SkillTradeOption[1].Click(); //Enter Credit Amount CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //Select ActiveOption switch ((GlobalDefinitions.ExcelLib.ReadData(2, "Active"))) { case "Active": //Select Active status ActiveOption[0].Click(); break; case "Hidden": //Select Hidden status ActiveOption[1].Click(); break; } //Click on work sample file add icon FileAdd.Click(); //Add work sample file using AutoIT AutoItX.WinWait("[CLASS:#32770]", "", 30); Thread.Sleep(3000); AutoItX.WinWaitActive("Open"); AutoItX.ControlFocus("Open", "", "Edit1"); AutoItX.ControlSetText("Open", "", "Edit1", @"C:\Study\IndustryConnect\git\ProjectMarsTestAutomationHybridFramework\MarsFramework\testFile.txt"); Thread.Sleep(3000); AutoItX.ControlClick("Open", "", "Button1"); //Click on Save button Save.Click(); //Waiting for Manage Listing page to load GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//table[1]/tbody[1]"), 10); }
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 EditShareSkill(string title, string desc, string cat, string subCat, string tag, string serviceType, string locType, //string Sdate, string Edate, //string StartTime, string EndTime, string Skilltrade, string SkillExchangeTag, string credit, string active) { Title.EnterText(title); Description.EnterText(desc); //Select dropbox CategoryDropDown.SelectFromDDL(cat); SubCategoryDropDown.SelectFromDDL(subCat); //Enter value in tag Tags.EnterText(tag); //Enter Key Tags.SendKeys(Keys.Enter); //check Tag entered Assert.IsNotNull(Tags, "Test fail- Tag Empty"); //Enter Service Type if (serviceType == "Hourly basis service") { GlobalDefinitions.driver.FindElement(By.XPath("//label[contains(.,'Hourly basis service')]")).Clicks(); } else if (serviceType == "One-off service") { GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='serviceType'][@type='radio'][@value='1']")).Clicks(); } //Enter Location Type if (locType == "On-site") { GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='locationType'][@value='0']")).Clicks(); } else if (locType == "Online") { GlobalDefinitions.driver.FindElement(By.XPath("(//input[contains(@name,'locationType')])[1]")).Clicks(); } //Enter Skill Trade if (Skilltrade == "Skill-Exchange") { GlobalDefinitions.driver.FindElement(By.XPath("//label[contains(.,'Skill-exchange')]")).Clicks(); } else if (Skilltrade == "Credit") { GlobalDefinitions.driver.FindElement(By.XPath("//label[contains(.,'Credit')]")).Clicks(); } //Click Hiddden Bullet if (active == "Active") { GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='isActive'][@value='false']")).Clicks(); } else { GlobalDefinitions.driver.FindElement(By.XPath("(//input[contains(@name,'isActive')])[2]")).Clicks(); } //Save Button SaveButton1.Clicks(); }
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() { //Extension custom method //Click on Share skill tab ShareSkillButton.Clicks(); Title.EnterText("Selenium"); Description.EnterText("Would you like to provide Selenium training?"); //Select dropbox CategoryDropDown.SelectFromDDL("Programming & Tech"); SubCategoryDropDown.SelectFromDDL("Databases"); //Enter value in tag Tags.EnterText("Tag14"); //Enter Key Tags.SendKeys(Keys.Enter); Thread.Sleep(1000); //check Tag entered Assert.IsNotNull(Tags, "Test fail- Tag Empty"); //Enter Service Type GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='serviceType'][@type='radio'][@value='1']")).Clicks(); //Enter Location Type GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='locationType'][@value='0']")).Clicks(); ////Enter Start date //GlobalDefinitions.driver.FindElement(By.Name("startDate")).EnterText("11192019"); ////Enter End date //GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='endDate']")).EnterText("11252019"); ////select the days and time //GlobalDefinitions.driver.FindElement(By.XPath("//inpu" + // "t[@tabindex='0'][@index='0'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[1]")).EnterText("09:00AM"); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[1]")).EnterText("05:00PM"); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='1'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[2]")).EnterText("09:00AM"); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[2]")).EnterText("05:00PM"); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='2'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[3]")).EnterText("09:00AM"); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[3]")).EnterText("05:00PM"); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='3'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[4]")).EnterText("09:00AM"); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[4]")).EnterText("05:00PM"); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='4'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[5]")).EnterText("09:00AM"); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[5]")).EnterText("05:00PM"); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='5'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[6]")).EnterText("09:00AM"); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[6]")).EnterText("05:00PM"); //GlobalDefinitions.driver.FindElement(By.XPath("//input[@tabindex='0'][@index='6'][@name='Available']")).Clicks(); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='StartTime'])[7]")).EnterText("09:00AM"); //GlobalDefinitions.driver.FindElement(By.XPath("(//input[@name='EndTime'])[7]")).EnterText("05:00PM"); //Enter Skill Trade GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='skillTrades'][@tabindex='0'][@value='false']")).Clicks(); //hidden credit //GlobalDefinitions.driver.FindElement(By.XPath("GlobalDefinitions.driver.FindElement(By.XPath")).EnterText("9"); //Work Sample using SendKey IWebElement ws = GlobalDefinitions.driver.FindElement(By.XPath("//i[@class='huge plus circle icon padding-25']")); ws.Clicks(); //using AutoIT upload file AutoItX.WinWaitActive("Open"); AutoItX.Send(@"C:\Mars\Test error.txt"); AutoItX.Sleep(5); AutoItX.Send("{ENTER}"); // Assert.IsTrue(ws != null, "File upload Fail"); //IWebElement file = GlobalDefinitions.driver.FindElement(By.XPath("//span[@class='tooltiptext']")); // Assert.That(file.Text == "Test error.txt", "File uploaded Fail"); try { IWebElement file = GlobalDefinitions.driver.FindElement(By.XPath("//span[@class='tooltiptext']")); Assert.That(file.Text != null, "File uploaded Fail"); } catch (NoSuchElementException) { Assert.Fail("File Uploaded Fail"); } //Click Hidden Bullet GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='isActive'][@value='false']")).Clicks(); Thread.Sleep(2000); //Save Button Save.Clicks(); }
internal void Edit_InputData(int dataRow) { Thread.Sleep(2000); Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Thread.Sleep(2000); //CategoryDropDown.Clear(); CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //CategoryDropDown.Click(); Thread.Sleep(2000); SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); SubCategoryDropDown.Click(); Tags.Clear(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); Tags.Click(); //Edit Service Type Thread.Sleep(2000); string ServiceType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "ServiceType"); if (ServiceType == "Hourly basis service") { ServiceHourly.Click(); } else { ServiceOneOff.Click(); } //Edit Location Type Thread.Sleep(2000); string LocationType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "LocationType"); if (LocationType == "Online") { LocationOnline.Click(); } else { LocationOnSite.Click(); } //Date and time StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); // Fill End Date EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Days.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")); //StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Startdate") + Keys.Enter); //StartDateDropDown.Click(); //EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Enddate") + Keys.Enter); //EndDateDropDown.Click(); StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "StartTime") + Keys.Enter); StartTimeDropDown.Click(); EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "EndTime") + Keys.Enter); EndTimeDropDown.Click(); SkillExchange.Click(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Skill-Exchange") + Keys.Enter); ActiveOption.Click(); Thread.Sleep(2000); }
//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); } }
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); }
//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 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); } }
//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); } }