public void SearchSkill() { Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "SearchSkill"); GlobalDefinitions.Wait(); TxtSearcSkill.SendKeys(ExcelLib.ReadData(2, "Category")); SearchIcon.Click(); //Checking the right page Assert.AreEqual("Search", GlobalDefinitions.driver.Title); Base.test = Base.extent.StartTest("On Share Search page"); TxtSubCategory.SendKeys(ExcelLib.ReadData(2, "SubCategory")); SearchUser.SendKeys(ExcelLib.ReadData(2, "SearchUser")); IList <IWebElement> optionsToSelect = GlobalDefinitions.driver.FindElements(By.XPath("//input[@placeholder='Search user']")); foreach (IWebElement options in optionsToSelect) { Console.WriteLine(options); if (options.Text.Equals(SearchUser)) { Console.WriteLine("Trying to select: " + SearchUser); options.Click(); break; } } Onsite.Click(); Online.Click(); ShowAll.Click(); }
internal void Search_skill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SearchSkill"); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[1]/input", 10000); SearchButton.Click(); SearchButton.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SearchSkill")); //SearchButton.SendKeys("selenium with java"); //Enter search skill GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[1]/i", 10000); ClickSkill.Click(); // search skill catagory GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[2]/input", 10000); searchSkill.Click(); searchSkill.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SearchSkillCategory")); //searchSkill.SendKeys("Programming $ Tech"); //Click search skill GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[2]/i", 10000); ClickSearckSkill.Click(); //Search user GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[3]/div[1]/div/div[1]/input", 10000); SearchUser.Click(); SearchUser.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "UserName")); //SearchUser.SendKeys("zorawar badhan"); Thread.Sleep(2000); //click Search user GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-search-section']/div[2]/div/section/div/div[1]/div[3]/div[1]/div/div[2]/div[1]/div/span", 10000); ClickSearchUser.Click(); Thread.Sleep(2000); Base.test.Log(LogStatus.Info, "Skill search is successfull"); }