////Click on View Button
        //[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[1]/td[8]/i[1]")]
        //private IWebElement ViewBtn { get; set; }
        #endregion


        #region Add Skills

        public void AddShareSkills()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills");
            Thread.Sleep(2000);

            //Click on ShareSkills
            Thread.Sleep(5000);
            Shareskills.Click();

            //Click on Title
            Thread.Sleep(5000);
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            Thread.Sleep(500);

            //Click on Description
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Base.test.Log(LogStatus.Info, "Description Added Sucessfully");

            //Add Category
            Thread.Sleep(4000);
            //Actions action = new Actions(GlobalDefinitions.driver);
            //action.Click(Category);
            Category.Click();
            //action.MoveToElement(Category).Build().Perform();
            Console.WriteLine("Clicked on the Category");
            Thread.Sleep(2000);
            IList <IWebElement> CategoryList = Category.FindElements(By.TagName("option"));
            int Count = CategoryList.Count;

            Thread.Sleep(500);
            for (int i = 0; i < Count; i++)
            {
                Console.WriteLine("in");

                if (CategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category").Trim())
                //if (CategoryList[i].Text == " Graphics & Design ".Trim())
                {
                    Thread.Sleep(1000);
                    CategoryList[i].Click();
                    Base.test.Log(LogStatus.Info, " Category Selected");
                }
            }

            //Add SubCategory
            SubCategory.Click();
            Console.WriteLine("Clicked on the SubCategory");
            Thread.Sleep(2000);
            IList <IWebElement> SubCatogeryList = SubCategory.FindElements(By.TagName("option"));

            //int count = SubCatogeryList.Count;
            Thread.Sleep(500);
            for (int i = 0; i < SubCatogeryList.Count; i++)
            {
                if (SubCatogeryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory").Trim())
                {
                    Thread.Sleep(1000);
                    SubCatogeryList[i].Click();
                    Base.test.Log(LogStatus.Info, " SubCategory Selected");
                }
            }

            // Add Tags
            AutoItX3 autoIt = new AutoItX3();

            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            autoIt.Send("{Enter}");
            Base.test.Log(LogStatus.Info, " Tags Added successfully");

            // Select Service Type
            Thread.Sleep(1000);

            if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == " Hourly badis sevice ")
            {
                Servicetype.Click();
            }
            else
            {
                ServiceType.Click();
            }
            Base.test.Log(LogStatus.Info, "Service type Added successfully");

            //Select Location Type
            Thread.Sleep(1000);
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site")
            {
                Locationtype.Click();
            }
            else
            {
                LocationType.Click();
            }
            Base.test.Log(LogStatus.Info, "Location Type Edited successfully");

            //Monday selection
            MondayCheckBox.Click();
            MondayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));
            Thread.Sleep(1000);
            MondayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));
            Thread.Sleep(1000);

            //Tuesday Selection
            TuesdayCheckBox.Click();
            TuesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Start Time"));
            TuesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "End Time"));

            //Wednesday Selection
            Wednesdaycheckbox.Click();
            WednesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "Start Time"));
            WednesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "End Time"));

            //Selecting Skill Trade
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit")
            {
                Thread.Sleep(1000);
                Skilltrade.Click();
            }
            else
            {
                Thread.Sleep(1000);
                SkillTrade.Click();
            }
            Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

            // Enter Credit
            Thread.Sleep(1000);
            Credit.Clear();
            Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
            Thread.Sleep(1000);
            Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

            //Upload WorkSample
            Thread.Sleep(3000);
            WorkSample.Click();
            Thread.Sleep(1000);
            AutoItX3 autoit = new AutoItX3();

            autoit.WinActivate("Open");
            autoit.Send(@"c:\users\rajesh jasti\Documents\ProfilePhoto.jpg");
            Thread.Sleep(2000);
            autoit.Send("{Enter}");
            Base.test.Log(LogStatus.Info, "Image Edited successfully");

            //Selecting Active
            Thread.Sleep(4000);
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Hidden")
            {
                Hidden.Click();
            }
            else
            {
                ActiveBtn.Click();
            }

            //Click on Save Button
            SaveBtn.Click();
        }
Example #2
0
        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");
        }