Exemple #1
0
        public void testInitialize()
        {
            var capabilitiesInternet = new OpenQA.Selenium.Remote.DesiredCapabilities();

            capabilitiesInternet.SetCapability("ignoreProtectedModeSettings", true);
            WebDriver = new ChromeDriver(@"C:\chromedriver_win32\");
        }
Exemple #2
0
        /// <summary>
        ///   Yahoo overrides standard DOM event methods (i.e. onclick("", ...)) causing webdriver to trigger unexpected memory protection exceptions 
        /// </summary>
        public static IWebDriver CreateWithDefaultProperties()
        {
            var caps = new OpenQA.Selenium.Remote.DesiredCapabilities();
            caps.SetCapability(OpenQA.Selenium.Remote.CapabilityType.HasNativeEvents, false);
            
            var driver = new FirefoxDriver(caps);
            driver.Manage().Window.Maximize();
            driver.Manage().Cookies.DeleteAllCookies();

            return driver;
        }
        private static void CreateDriver(string Driver)
        {
            switch (Driver)
            {
            case "IE":
                var ieService = InternetExplorerDriverService.CreateDefaultService();
                //ieService.HideCommandPromptWindow = true;

                InternetExplorerOptions ieOptions = new InternetExplorerOptions();
                ieOptions.SetLoggingPreference(LogType.Driver, LogLevel.Severe);


                //ieOptions.RequireWindowFocus = true;
                //ieOptions.EnablePersistentHover = true;
                //ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;

                //ieOptions.AddAdditionalCapability("requireWindowFocus", true);
                //ieOptions.AddAdditionalCapability("enablePersistentHover", false);

                webDriver = new InternetExplorerDriver(ieService, ieOptions, TimeSpan.FromSeconds(300));
                webDriver.Manage().Window.Maximize();
                webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));
                webDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(300));
                break;

            case "Firefox":
                var options = new FirefoxOptions();
                FirefoxDriverService ffService = FirefoxDriverService.CreateDefaultService(@"\\s-files\QA_IT\Ascendum_Automation", "geckodriver.exe");
                //ffService.HideCommandPromptWindow = true;


                //FirefoxDriverService service2 = new FirefoxDriverService//new FirefoxDriverService(@"\\s-files\QA_IT\Ascendum_Automation\geckodriver.exe");

                //System.setProperty("webdriver.gecko.driver", "G:\\Selenium\\Firefox driver\\geckodriver.exe");
                webDriver = new FirefoxDriver(ffService);
                webDriver.Manage().Window.Maximize();

                //ITimeouts time;
                //time. = TimeSpan.FromSeconds(30);
                webDriver.Manage().Timeouts().PageLoad     = TimeSpan.FromSeconds(30);
                webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
                break;

            case "Chrome":
                OpenQA.Selenium.Remote.DesiredCapabilities cap = new OpenQA.Selenium.Remote.DesiredCapabilities();
                ChromeOptions op = new ChromeOptions();
                op.LeaveBrowserRunning = true;
                webDriver = new ChromeDriver(op);
                webDriver.Manage().Window.Maximize();
                webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
                break;
            }
        }
Exemple #4
0
        public void How_To_Handle_Https_Certifications()
        {
            OpenQA.Selenium.Remote.DesiredCapabilities cap = new OpenQA.Selenium.Remote.DesiredCapabilities();
            cap.SetCapability("Aceept_ssl_certs", "true");

            ChromeOptions options = new ChromeOptions();

            options.AddAdditionalCapability("Aceept_ssl_certs", "true");
            options.AddArgument("start-maximized");                                         //Opens Chrome in maximize mode
            options.AddArgument("incognito ");                                              //Opens Chrome in incognito mode
            options.AddArgument("headless");                                                //Opens Chrome in headless mode
            options.AddAdditionalCapability("download.default_directory", "Download Path"); //Change the download path
            //TestSetup.driver = new ChromeDriver(@"C:\Users\Gitesh\source\repos\UnitTestProject1\packages\Selenium.Chrome.WebDriver.2.33\driver", options);
        }
 public void testInitialize()
 {
     var capabilitiesInternet = new OpenQA.Selenium.Remote.DesiredCapabilities();
     capabilitiesInternet.SetCapability("ignoreProtectedModeSettings", true);
     WebDriver = new ChromeDriver(@"C:\chromedriver_win32\");
 }