当前位置: 首页>>代码示例>>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;未经允许,请勿转载。