예제 #1
0
        private void FindAndGotoLink(string linkText)
        {
            string link = SafeExecutor.ExecuteFunc(() =>
            {
                var ln = GetLeftNav(driver);
                return(ln.FindElement(By.LinkText(linkText)).GetAttribute("href"));
            });

            if (link == null)
            {
                throw new Exception("Cannot find Link: " + linkText);
            }

            driver.Navigate().GoToUrl(link);
        }
예제 #2
0
        private IWebElement GetLeftNav(ChromeDriver driver)
        {
            var ele = SafeExecutor.ExecuteFunc(() =>
            {
                try
                {
                    return(driver.FindElementById(LeftNavContainer));
                }
                catch
                {
                    return(driver.FindElementById("s-refinements"));
                }
            });

            if (ele == null)
            {
                throw new Exception("Cannot find " + LeftNavContainer);
            }
            else
            {
                return(ele);
            }
        }