示例#1
0
        internal void FillSchedrule(int DataRow)
        {
            //Check if the user is able to click on a "Start Date" for the "Available days" field
            StartDateDropDown.Click();
            StartDateDropDown.Clear();
            StartDateDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "StartDate"));

            //Check if the user is able to click on a "End Date" for the "Available days" field
            EndDateDropDown.Click();
            EndDateDropDown.Clear();
            EndDateDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "EndDate"));

            //Check if the user is able to click on a "Day" checkbox for the "Available days" field
            for (var i = 1; i <= 5; i++)
            {
                Days[i].Click();
            }

            //Check if the user is able to select a "Start Time" for the "Available days" field
            StartTimeDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "StartTime"));

            //Check if the user is able to select a "End Time" for the "Available days" field
            EndTimeDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "EndTime"));

            //Check if the user is able to click on "Credits" as the "Skill Trade" option
            SkillTradeCreditsOption.Click();

            //Check if the user is able to enter a number for the "Credits" field
            CreditAmount.Clear();
            CreditAmount.SendKeys(GlobalDefinitions.ReadData(DataRow, "Credit"));

            //Check if the user is able to set an option for the "Active" field
            ActiveOption.Click();
        }
示例#2
0
        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);
        }
示例#3
0
 internal void AddDayTimeDetails(int dataRow)
 {
     StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Startdate") + Keys.Enter);
     EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Enddate") + Keys.Enter);
     DayMon.Click();
     StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Starttime") + Keys.Enter);
     EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Endtime") + Keys.Enter);
     SkillTradeExchange.Click();
     SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Skill-Exchange") + Keys.Enter);
 }
示例#4
0
        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();
        }
示例#5
0
        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);
            }
        }
示例#6
0
        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"));
        }
示例#7
0
        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 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);
        }
示例#9
0
        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();
                }
            }
        }
 internal void SelectStartTimeDropDown()
 {
     // //Click on StartTime dropdown
     StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime"));
     Base.test.Log(LogStatus.Info, "Entered StartTime");
 }