Example #1
0
 public SearchResultsPage SearchForProduct(string productName)
 {
     SearchInput.Clear();
     SearchInput.SendKeys(productName);
     SubmitSearchButton.Click();
     return(new SearchResultsPage(driver));
 }
        // method taken from IDM automation tests
        /// <summary>
        /// Search for the email containing the specified subject line
        /// </summary>
        /// <param name="subjectline">The subject line of the email to search for</param>
        /// <returns>True if the email was found, false otherwise</returns>
        public bool SearchForEmail(string subjectline)
        {
            //var searchInput = Driver.FindElement(By.Id("gbqfq"));
            //var startSearch = Driver.FindElement(By.Id("gbqfb"));
            SearchInput.Clear();
            SearchInput.SendKeys(subjectline);
            StartSearch.WaitAndClick(_driver);
            int i = 0;
            int c = 0;

            do
            {
                System.Threading.Thread.Sleep(750);
                _driver.SwitchTo().DefaultContent();
                var results = _driver.FindElements(By.XPath("//*[contains(@class, 'TC')]"));
                c = 0;
                foreach (var result in results)
                {
                    bool visibile = result.Displayed;
                    if (visibile)
                    {
                        c++;
                    }
                }
                i++;
            }while (c > 0 && i < 30);

            var Tables = _driver.FindElements(By.XPath("//*[contains(@class, 'F cf zt')]"));

            foreach (var table in Tables)
            {
                bool visibility = table.Displayed;
                if (visibility == true)
                {
                    return(true);
                }
            }
            return(false);
        }
 public void ClearSearchInput()
 {
     SearchInput.Clear();
 }
Example #4
0
 public MainPage InputSearch(Search search)
 {
     SearchInput.Clear();
     SearchInput.SendKeys(search.SearchText);
     return(new MainPage(driver));
 }