Exemplo n.º 1
0
        private void StartWebbrowser(string path, BrowserOptions browerOptions)
        {
            switch (browerOptions.BrowserType)
            {
            case (Browsers.Chrome):
                var chromeOptions = new ChromeOptions();
                chromeOptions.AddArguments("--dns-prefetch-disable", "start-maximized", "test-type");
                if (browerOptions.RunInIncognito)
                {
                    // opens a private browser window, immune to cookies of other open windows (unless also private)
                    chromeOptions.AddArgument("--incognito");
                }
                if (browerOptions.AllowInsecureContent)
                {
                    chromeOptions.AddArgument("--allow-running-insecure-content");
                }
                _webdriver = new ChromeDriver(path, chromeOptions);
                break;

            case (Browsers.Firefox):
                _webdriver = new FirefoxDriver(path);
                _webdriver.Manage().Window.Maximize();
                break;
            }
        }
Exemplo n.º 2
0
        public WebBrowser(BrowserOptions browserOptions = null)
        {
            // the drivers folder containing the .exe will be in the same folder as the dll running the tests, find it
            var driverDirectory =
                Path.GetDirectoryName(
                    Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)) +
                @"\Drivers";

            StartWebbrowser(driverDirectory, browserOptions ?? new BrowserOptions());
        }
Exemplo n.º 3
0
 public WebBrowser(string path, BrowserOptions browserOptions)
 {
     StartWebbrowser(path, browserOptions);
 }