Exemplo n.º 1
0
        public IWebDriver VisitInBrowser()
        {
            _output.WriteLine($"Opening browser at {_listeningUri}...");
            var driver = WebDriverFactory.CreateWebDriver();

            driver.Navigate().GoToUrl(_listeningUri);

            if (driver is EdgeDriver)
            {
                // Workaround for untrusted ASP.NET Core development certificates.
                // The edge driver doesn't supported skipping the SSL warning page.

                if (driver.Title.Contains("Certificate error", StringComparison.OrdinalIgnoreCase))
                {
                    _output.WriteLine("Page contains certificate error. Attempting to get around this...");
                    driver.Click(By.Id("moreInformationDropdownSpan"));
                    var continueLink = driver.FindElement(By.Id("invalidcert_continue"));
                    if (continueLink != null)
                    {
                        _output.WriteLine($"Clicking on link '{continueLink.Text}' to skip invalid certificate error page.");
                        continueLink.Click();
                        driver.Navigate().GoToUrl(_listeningUri);
                    }
                    else
                    {
                        _output.WriteLine("Could not find link to skip certificate error page.");
                    }
                }
            }

            return(driver);
        }
Exemplo n.º 2
0
        public IWebDriver VisitInBrowser()
        {
            _output.WriteLine($"Opening browser at {_listeningUri}...");
            var driver = WebDriverFactory.CreateWebDriver();

            driver.Navigate().GoToUrl(_listeningUri);
            return(driver);
        }