當前位置: 首頁>>代碼示例>>C#>>正文


C# IE.InternetExplorerOptions類代碼示例

本文整理匯總了C#中OpenQA.Selenium.IE.InternetExplorerOptions的典型用法代碼示例。如果您正苦於以下問題:C# InternetExplorerOptions類的具體用法?C# InternetExplorerOptions怎麽用?C# InternetExplorerOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InternetExplorerOptions類屬於OpenQA.Selenium.IE命名空間,在下文中一共展示了InternetExplorerOptions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FakeIEDriver

        public FakeIEDriver(string internetExplorerDriverServerDirectory, InternetExplorerOptions options)
        {
Console.WriteLine("dir opt2");
            this.UnitTestReport =
                //IEDriverConstructorOptions.ie_with_path_and_options.ToString();
                DriverServerConstructorOptions.with_path_and_options.ToString();
        }
開發者ID:MatkoHanus,項目名稱:STUPS,代碼行數:7,代碼來源:FakeIEDriver.cs

示例2: GetDriver

        //Start the browser depending on the setting
        public void GetDriver(WebBrowsers webBrws)
        {
            WebBrws = webBrws;
            if (webBrws == WebBrowsers.Ie)
            {
                //Secutiry setting for IE
                var capabilitiesInternet = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true };
                Driver = new InternetExplorerDriver(capabilitiesInternet);
            }
            else
                if (webBrws == WebBrowsers.FireFox)
                {
                    //FirefoxBinary binary = new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe");
                    FirefoxProfile profile = new FirefoxProfile();
                    // profile.SetPreference("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
                    Driver = new FirefoxDriver(profile);
                }
                else
                    if (webBrws == WebBrowsers.Chrome)
                    {
                        //Chrome driver requires the ChromeDriver.exe
                        Driver = new ChromeDriver(@"..\..\..\lib\BrowserDriver\Chrome");
                    }
                    else { throw new WebDriverException(); }

            Selenium = new WebDriverBackedSelenium(Driver, BaseUrl);
        }
開發者ID:ectechno,項目名稱:seshell,代碼行數:28,代碼來源:BaseClass.cs

示例3: logging_in_with_invalid_credentials

        public void logging_in_with_invalid_credentials()
        {
            var options = new InternetExplorerOptions();
            options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;

            var driver = new InternetExplorerDriver(options);
            driver.Navigate().GoToUrl(TargetAppUrl + "/Authentication/LogOff");

            try
            {
                driver.Navigate().GoToUrl(TargetAppUrl + "/LogOn");

                driver.FindElement(By.Name("EmailAddress")).SendKeys("[email protected]");
                driver.FindElement(By.Name("Password")).SendKeys("BadPass");
                driver.FindElement(By.TagName("form")).Submit();

                driver.Url.ShouldEqual(TargetAppUrl + "/LogOn");

                driver.FindElement(By.ClassName("validation-summary-errors")).Text.ShouldContain(
                    "The user name or password provided is incorrect.");
            }
            finally
            {
                driver.Close();
            }
        }
開發者ID:pixelcode,項目名稱:Fail-Tracker,代碼行數:26,代碼來源:AuthenticationSpecs.cs

示例4: PerformInitialize

 /// <summary>
 /// Performs the initialize of the browser.
 /// </summary>
 /// <param name="driverFolder">The driver folder.</param>
 /// <param name="proxy">The proxy.</param>
 /// <returns>
 /// The web driver.
 /// </returns>
 protected override IWebDriver PerformInitialize(string driverFolder, Proxy proxy)
 {
     var options = new InternetExplorerOptions();
     options.Proxy = proxy;
     options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
     return new InternetExplorerDriver(driverFolder, options);
 }
開發者ID:giacomelli,項目名稱:SpecFlowHelper,代碼行數:15,代碼來源:IEBrowser.cs

示例5: GetConfigBrowser

        public static IWebDriver GetConfigBrowser(string browserName)
        {
            string AppRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string strDriverPath = null;
            IWebDriver webDriver = null;
            if (browserName.Equals("Firefox", StringComparison.InvariantCultureIgnoreCase))
            {
                webDriver = new FirefoxDriver();
            }
            else if (browserName.Equals("chrome", StringComparison.InvariantCultureIgnoreCase))
            {
                strDriverPath = Path.Combine(AppRoot, @"CodedUITests\Drivers\chromedriver_win32");
                webDriver = new ChromeDriver(strDriverPath);

            }
            else if (browserName.Equals("IE", StringComparison.InvariantCultureIgnoreCase))
            {
                InternetExplorerOptions options = new InternetExplorerOptions()
                {
                    EnableNativeEvents = true,
                    IgnoreZoomLevel = true
                };
                strDriverPath = Path.Combine(AppRoot, @"CodedUITests\Drivers\IEDriverServer_Win32_2.44.0");
                webDriver = new InternetExplorerDriver(strDriverPath, options, TimeSpan.FromMinutes(3.0));
            }
            if (webDriver == null)
                throw new Exception("must configure browsername in aap.config");
            else
                return webDriver;
        }
開發者ID:wpdiary,項目名稱:PolyGlotPersistence,代碼行數:30,代碼來源:BrowserSelect.cs

示例6: SetupDriver

        /// <summary>
        /// Creates a driver if it has not been created yet. 
        /// </summary>
        public void SetupDriver()
        {
            if (_driver == null)
            {
                switch (DriverType)
                {
                    case DriverTypes.Phantom:
                        _driver = new PhantomJSDriver(DriversPath);
                        break;
                    case DriverTypes.Firefox:
                        _driver = new FirefoxDriver();
                        break;
                    case DriverTypes.InternetExplorer:
                        var options = new InternetExplorerOptions();
                        options.IgnoreZoomLevel = true;
                        _driver = new InternetExplorerDriver(DriversPath, options);

                        break;
                    case DriverTypes.Chrome:
                    default:
                        if (!File.Exists("chromedriver.exe"))
                        {
                            _driver = new ChromeDriver(DriversPath);
                        }
                        else
                            _driver = new ChromeDriver();
                        break;
                }
            }

        }
開發者ID:J4S0Nc,項目名稱:Useful.Utilities,代碼行數:34,代碼來源:WebDriver.cs

示例7: InitDriver

        public void InitDriver()
        {
            if (!Directory.Exists(@"P:\LabsDeploymentItems")) throw new Exception(@"Unable to locate P:\LabsDeploymentItems");

            switch (Properties.Settings.Default.BROWSER)
            {
                case BrowserType.Chrome:
                    WebDriver = new ChromeDriver(driversLocation);
                    break;
                case BrowserType.Ie:
                    InternetExplorerOptions opts = new InternetExplorerOptions();
                    opts.EnsureCleanSession = true;
                    opts.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                    WebDriver = new InternetExplorerDriver(driversLocation, opts);
                    break;
                case BrowserType.Firefox:
                    WebDriver = new FirefoxDriver();
                    break;
                default:
                    throw new ArgumentException("Invalid BROWSER Setting has been used");
            }

            WebDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Properties.Settings.Default.IMPLICIT_WAIT_SECONDS));
            WebDriver.Manage().Window.Maximize();
        }
開發者ID:pjagga,項目名稱:SeleniumMSTestVS2013,代碼行數:25,代碼來源:BrowserContext.cs

示例8: Start

        /// <summary>
        /// Starts the specified browser.
        /// </summary>
        /// <param name="browser">The browser.</param>
        /// <exception cref="System.NotSupportedException">When driver not supported</exception>
        public void Start(string browser)
        {
            switch (browser)
            {
                case "Firefox":
                    Handle = new FirefoxDriver(this.FirefoxProfile);
                    break;
                case "FirefoxPortable":

                    var profile = this.FirefoxProfile;
                    var firefoxBinary = new FirefoxBinary(BaseConfiguration.FirefoxPath);
                    Handle = new FirefoxDriver(firefoxBinary, profile);
                    break;
                case "InternetExplorer":
                    var options = new InternetExplorerOptions
                    {
                        EnsureCleanSession = true,
                    };
                    Handle = new InternetExplorerDriver(@"Drivers\", options);
                    break;
                case "Chrome":
                    Handle = new ChromeDriver(@"Drivers\");
                    break;
                default:
                    throw new NotSupportedException(
                        string.Format(CultureInfo.CurrentCulture, "Driver {0} is not supported", browser));
            }

            Handle.Manage().Window.Maximize();
        }
開發者ID:raczeja,項目名稱:Test.Automation,代碼行數:35,代碼來源:BrowserManager.cs

示例9: CreateWebDriver

        private static IWebDriver CreateWebDriver()
        {
            IWebDriver driver = null;

            var type = ConfigurationManager.AppSettings["WebDriver"];
            switch (type)
            {
                case "Firefox":
                    {
                        var profile = new FirefoxProfile
                        {
                            AcceptUntrustedCertificates = true,
                            EnableNativeEvents = true
                        };
                        driver = new FirefoxDriver(profile);

                        break;
                    }
                case "InternetExplorer":
                    {
                        // Currently not working
                        var options = new InternetExplorerOptions
                        {
                            IgnoreZoomLevel = true
                        };
                        driver = new InternetExplorerDriver(options);

                        break;
                    }                    
                case "Chrome":
                default:
                    throw new NotSupportedException();
            }
            return driver;
        }
開發者ID:sergiofagostinho,項目名稱:netponto.specflow,代碼行數:35,代碼來源:WebDriverHelper.cs

示例10: GetLocalDriver

        /// <summary>
        /// ‘абричный метод
        /// </summary>
        /// <param name="browser"></param>
        /// <returns></returns>
        public static RemoteWebDriver GetLocalDriver(string browser)
        {
            InternetExplorerOptions internetExplorerOptions;
            switch (browser)
            {
                case "Chrome":
                    return new ChromeDriver(PathToDriver);

                case "Firefox":
                    var profile = new FirefoxProfile();
                    //profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", ConfigurationManager.AppSettings["SiteIP"]);
                    return new FirefoxDriver(profile);

                case "IE":
                    internetExplorerOptions = new InternetExplorerOptions
                    {
                        IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                        EnableNativeEvents = true
                    };
                    return new InternetExplorerDriver(
                        PathToDriver,
                        internetExplorerOptions);

                default:
                    internetExplorerOptions = new InternetExplorerOptions
                    {
                        IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                        EnableNativeEvents = true
                    };

                    return new InternetExplorerDriver(
                        PathToDriver,
                        internetExplorerOptions);
            }
        }
開發者ID:GulyaevB,項目名稱:AcceptanceTesting_demo,代碼行數:40,代碼來源:BrowserFactory.cs

示例11: Create

    public static IWebDriver Create(string browser)
    {
        DesiredCapabilities capabilities;
        IWebDriver driver;

        switch (browser) {
            case "chrome":
                capabilities = DesiredCapabilities.Chrome();
                driver = new RemoteWebDriver(remoteWebDriverUri, capabilities);
                break;
            case "internet explorer":
                InternetExplorerOptions options = new InternetExplorerOptions();
                options.IgnoreZoomLevel = true;
                capabilities = (DesiredCapabilities)options.ToCapabilities();
                driver = new RemoteWebDriver(remoteWebDriverUri, capabilities, TimeSpan.FromSeconds(10));
                break;
            case "edge":
                capabilities = DesiredCapabilities.Edge();
                driver = new RemoteWebDriver(remoteWebDriverUri, capabilities);
                break;
            default:
                capabilities = DesiredCapabilities.Firefox();
                driver = new RemoteWebDriver(remoteWebDriverUri, capabilities);
                break;
        }

        return driver;
    }
開發者ID:chrhol,項目名稱:Launcher,代碼行數:28,代碼來源:WebDriverFactory.cs

示例12: GetDriver

        public static IWebDriver GetDriver(DriverType typeOfDriver)
        {
            IWebDriver browser;
            switch (typeOfDriver)
            {
                // NOTE REMOTE DRIVER IS NOT SUPPORTED
                case DriverType.Chrome:
                    ChromeOptions co = new ChromeOptions();
                    browser = new ChromeDriver();
                    break;
                case DriverType.IE:
                    InternetExplorerOptions ieo = new InternetExplorerOptions();
                    browser = new InternetExplorerDriver();
                    break;
                case DriverType.Firefox:    
                default:
                    FirefoxProfile ffp = new FirefoxProfile();
                    ffp.AcceptUntrustedCertificates = true;
                    ffp.Port = 8181;

                    browser = new FirefoxDriver(ffp);
                    break;
            }
            return browser;
        }
開發者ID:kamcio,項目名稱:NSeleniumTestRunner,代碼行數:25,代碼來源:WebDriverFactory.cs

示例13: Create

        public IWebDriver Create(LocalDriverConfiguration configuration)
        {
            switch (configuration.Browser)
            {
                case "chrome":
                    _driver = new ChromeDriver(@"DriverServices");
                    break;

                case "internet explorer":
                    var options = new InternetExplorerOptions { EnableNativeEvents = false };
                    _driver = new InternetExplorerDriver(@"DriverServices", options);
                    break;

                case "firefox":
                    _driver = new FirefoxDriver();
                    break;

                case "phantomjs":
                    _driver = new PhantomJSDriver(@"DriverServices");
                    break;

                default:
                    _driver = new FirefoxDriver();
                    break;
            }

            return _driver;
        }
開發者ID:Varomir,項目名稱:SearchCSharp,代碼行數:28,代碼來源:WebDriverFactory.cs

示例14: Driver

        /// <summary>
        ///     Initializes a new instance of the <see cref="Driver"/> class.
        /// </summary>
        /// <param name="browser">Browser name.</param>
        /// <param name="timeout">Implicit time to wait.</param>
        public Driver(string browser, int timeout = 10)
        {
            this.timeout = timeout;

            Log.Debug("Working directory: " + this.directory);
            Log.Debug("Browser: " + browser);
            Log.Debug("Driver timeout: " + timeout);

            switch (browser)
            {
                case "firefox":
                    this.driver = new FirefoxDriver();
                    break;
                case "ie":
                    var ieOptions = new InternetExplorerOptions { EnsureCleanSession = true };
                    this.driver = new InternetExplorerDriver(this.directory, ieOptions);
                    break;
                case "edge":
                    this.driver = new EdgeDriver(this.directory);
                    break;
                case "chrome":
                    this.driver = new ChromeDriver(this.directory);
                    break;
                case "safari":
                    this.driver = new SafariDriver();
                    break;
                default:
                    throw new Exception("Browser name is incorrect.");
            }

            this.driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, timeout));
            this.driver.Manage().Cookies.DeleteAllCookies();
            this.driver.Manage().Window.Maximize();
        }
開發者ID:ograchikov,項目名稱:MailDriver,代碼行數:39,代碼來源:Driver.cs

示例15: NewWebDriver

 public IWebDriver NewWebDriver(Browser browser)
 {
     if (browser == Browser.Firefox)
         return new FirefoxDriver();
     if (browser == Browser.InternetExplorer)
     {
         var options = new InternetExplorerOptions
             {
                 IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                 EnableNativeEvents = true
             };
         return new InternetExplorerDriver(options);
     }
     if (browser == Browser.Chrome)
         return new ChromeDriver();
     if (browser == Browser.Android)
         return new AndroidDriver();
     if (browser == Browser.HtmlUnit)
         return new RemoteWebDriver(DesiredCapabilities.HtmlUnit());
     if (browser == Browser.HtmlUnitWithJavaScript) {
         DesiredCapabilities desiredCapabilities = DesiredCapabilities.HtmlUnit();
         desiredCapabilities.IsJavaScriptEnabled = true;
         return new RemoteWebDriver(desiredCapabilities);
     }
     if (browser == Browser.PhantomJS)
         return new PhantomJSDriver();
     return browserNotSupported(browser,null);
 }
開發者ID:MatteS75,項目名稱:coypu,代碼行數:28,代碼來源:DriverFactory.cs


注:本文中的OpenQA.Selenium.IE.InternetExplorerOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。