Пример #1
0
        internal EasyDriver(Browser browser)
        {
            var driverService = DriverServiceManager.Start(browser);

            DriverOptions options;

            switch (browser)
            {
            case Browser.Chrome:
                options = new ChromeOptions();
                break;

            case Browser.FireFox:
                options = new ChromeOptions();
                break;

            default:
                // TODO: Exception
                throw new Exception();
            }

            //options.BinaryLocation = pathToChromeDriver;
            var driver = RemoteWebDriverManager.GetNew(options);

            WebDriverManager.StoreDriver(driver);
        }
Пример #2
0
        public static RemoteWebDriver GetNew(DriverOptions driverOptions, string uri = null)
        {
            if (uri == null)
            {
                uri = $"http://127.0.0.1:{DriverServiceManager.Get().Port}";
            }

            _driver = new RemoteWebDriver(new Uri(uri), driverOptions);
            return(_driver);
        }
Пример #3
0
        /// <summary>
        /// Close browser with all open tabs
        /// </summary>
        public void Quit()
        {
            WebDriverManager.GetDriver().Quit();

            DriverServiceManager.Stop();
        }