internal void SearchSharedSkill() { Extension.WaitForElementDisplayed(Driver, By.CssSelector("input[placeholder='Search skills']"), 2); //Enter the title in search skill field and press enter SearchSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title") + "\n"); Extension.WaitForElementDisplayed(Driver, By.XPath("//b[text()='All Categories']/following-sibling::span"), 2); Thread.Sleep(2000); //Validate if All categories count is greater than 0 GlobalDefinitions.ValidateBoolean(int.Parse(AllCategoriesCount.Text) > 0, "All Categories shown"); //Validate Category and subcategory added count is greater than 0 when searched foreach (IWebElement Category in CategoriesList) { string CategoryValue = Category.Text.Replace(Category.FindElement(By.XPath("./*")).Text, "").TrimEnd(); if (CategoryValue.ToLower() == GlobalDefinitions.ExcelLib.ReadData(2, "Category").ToLower()) { Category.Click(); GlobalDefinitions.ValidateBoolean(int.Parse(Category.FindElement(By.XPath("span")).Text) > 0, "Category shown"); IList <IWebElement> SubCategoryList = Driver.FindElements(By.XPath("//a[@role='listitem'][@class='item subcategory']")); foreach (IWebElement SubCategory in SubCategoryList) { string SubCategoryValue = SubCategory.Text.Replace(SubCategory.FindElement(By.XPath("./*")).Text, "").TrimEnd(); if (SubCategoryValue.ToLower() == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory").ToLower()) { SubCategory.Click(); GlobalDefinitions.ValidateBoolean(int.Parse(SubCategory.FindElement(By.XPath("span")).Text) > 0, "SubCategory Shown"); Base.Image = SaveScreenShotClass.SaveScreenshot(Driver, "Report"); break; } } break; } } }
internal void EnterShareSkill() { //Thread.Sleep(3000); GlobalDefinitions.WaitForElement(_driver, By.LinkText("Share Skill"), 3000); //GlobalDefinitions.Wait(3000); //click share skill button ShareSkillBtn.Click(); GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "EnterShareSkill"); //Thread.Sleep(3000); //GlobalDefinitions.Wait(3000); GlobalDefinitions.WaitForElement(_driver, By.Name("title"), 3000); //Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Thread.Sleep(1000); GlobalDefinitions.Wait(1000); //Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Category Category.Click(); Category.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div[1]/select/option[7]")).Click(); GlobalDefinitions.Wait(1000); //Sub-Category SubCategory.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div[2]/div[1]/select/option[5]")).Click(); GlobalDefinitions.Wait(1000); //Tag Tag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tag")); Tag.SendKeys(Keys.Enter); //Service Service.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click(); // [Hourly basis service] GlobalDefinitions.Wait(3000); // Thread.Sleep(1000); //Service.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[2]/div/input")).Click(); [One-off Service] //Location // Location.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click(); [On-site] Location.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click(); // [Online] GlobalDefinitions.Wait(5000); //Available Days GlobalDefinitions.WaitForElement(_driver, By.Name("startDate"), 2000); //Start Date StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate")); GlobalDefinitions.WaitForElement(_driver, By.Name("endDate"), 2000); // End Date EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate")); GlobalDefinitions.Wait(2000); //Skill Trade SkillTrade.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[2]/div/div[1]/div/input")).Click(); // [Skill-exchange] //Skill Exchange SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange")); SkillExchange.SendKeys(Keys.Enter); //Thread.Sleep(1000); GlobalDefinitions.Wait(1000); //Active Active.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click(); // [Active] //Thread.Sleep(1000); GlobalDefinitions.Wait(1000); //Save Save.Click(); //Thread.Sleep(1000); GlobalDefinitions.Wait(1000); }