Exposes the service provided by the native IEDriverServer executable.
Наследование: DriverService
 private static IWebDriver CreateIEDriver(string driversDirectory)
 {
     IE.InternetExplorerDriverService ieService = IE.InternetExplorerDriverService.CreateDefaultService(driversDirectory);
     ieService.HideCommandPromptWindow = true;
     IE.InternetExplorerOptions options = new IE.InternetExplorerOptions()
     {
         IgnoreZoomLevel = true
     };
     return(new IE.InternetExplorerDriver(ieService, options));
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified driver service.
 /// </summary>
 /// <param name="service">The <see cref="InternetExplorerDriverService"/> used to initialize the driver.</param>
 public InternetExplorerDriver(InternetExplorerDriverService service)
     : this(service, new InternetExplorerOptions())
 {
 }
Пример #3
0
        private static IWebDriver CreateNewWebDriver(string webBrowserName, BrowserType type, out IntPtr mainWindowHandle, string driversDirectory)
        {
            webBrowserName = webBrowserName.ToLower();
            IWebDriver     iWebDriver            = null;
            List <Process> processesBeforeLaunch = GetProcesses();
            string         newProcessFilter      = string.Empty;

            switch (type)
            {
            case BrowserType.Chrome:
                var chromeService = Chrome.ChromeDriverService.CreateDefaultService(driversDirectory);
                chromeService.HideCommandPromptWindow = true;
                var chromeOptions = new Chrome.ChromeOptions();
                chromeOptions.PageLoadStrategy = PageLoadStrategy.None;
                chromeOptions.AddArgument("disable-infobars");
                chromeOptions.AddArgument("--disable-bundled-ppapi-flash");
                chromeOptions.AddArgument("--log-level=3");
                chromeOptions.AddArgument("--silent");
                chromeOptions.AddUserProfilePreference("credentials_enable_service", false);
                chromeOptions.AddUserProfilePreference("profile.password_manager_enabled", false);
                chromeOptions.AddUserProfilePreference("auto-open-devtools-for-tabs", false);
                //chromeOptions.AddAdditionalCapability("pageLoadStrategy", "none", true);
                iWebDriver       = new Chrome.ChromeDriver(chromeService, chromeOptions);
                newProcessFilter = "chrome";
                break;

            case BrowserType.Firefox:
                var firefoxService = Firefox.FirefoxDriverService.CreateDefaultService(driversDirectory);
                firefoxService.HideCommandPromptWindow = true;
                iWebDriver       = new Firefox.FirefoxDriver(firefoxService);
                newProcessFilter = "firefox";
                break;

            case BrowserType.InternetExplorer:
                IE.InternetExplorerDriverService ieService = IE.InternetExplorerDriverService.CreateDefaultService(driversDirectory);
                ieService.HideCommandPromptWindow = true;
                IE.InternetExplorerOptions options = new IE.InternetExplorerOptions()
                {
                    IgnoreZoomLevel = true
                };
                iWebDriver       = new IE.InternetExplorerDriver(ieService, options);
                newProcessFilter = "iexplore";
                break;

            case BrowserType.Edge:
                var edgeService = Edge.EdgeDriverService.CreateDefaultService(driversDirectory);
                edgeService.HideCommandPromptWindow = true;
                var edgeOptions = new Edge.EdgeOptions();
                edgeOptions.PageLoadStrategy = PageLoadStrategy.Eager;
                iWebDriver       = new Edge.EdgeDriver(edgeService, edgeOptions);
                newProcessFilter = "edge";
                break;

            default:
                throw new ArgumentException($"Could not launch specified browser '{webBrowserName}'");
            }
            var newProcess = GetNewlyCreatedProcesses(newProcessFilter, processesBeforeLaunch);

            mainWindowHandle = (newProcess != null) ? newProcess.MainWindowHandle : IntPtr.Zero;
            return(iWebDriver);
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified
 /// <see cref="DriverService"/>, <see cref="InternetExplorerOptions"/>, and command timeout.
 /// </summary>
 /// <param name="service">The <see cref="InternetExplorerDriverService"/> to use.</param>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public InternetExplorerDriver(InternetExplorerDriverService service, InternetExplorerOptions options, TimeSpan commandTimeout)
     : base(new DriverServiceCommandExecutor(service, commandTimeout), ConvertOptionsToCapabilities(options))
 {
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class with the desired
 /// options.
 /// </summary>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 public InternetExplorerDriver(InternetExplorerOptions options)
     : this(InternetExplorerDriverService.CreateDefaultService(), options)
 {
 }
Пример #6
0
 public EdgeInternetExplorerModeDriver(InternetExplorerDriverService service, InternetExplorerOptions options)
     : base(service, options)
 {
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified
 /// <see cref="InternetExplorerDriverService"/> and options.
 /// </summary>
 /// <param name="service">The <see cref="DriverService"/> to use.</param>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 public InternetExplorerDriver(InternetExplorerDriverService service, InternetExplorerOptions options)
     : this(service, options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified driver service.
 /// </summary>
 /// <param name="service">The <see cref="InternetExplorerDriverService"/> used to initialize the driver.</param>
 public InternetExplorerDriver(InternetExplorerDriverService service)
     : this(service, new InternetExplorerOptions())
 {
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified path
 /// to the directory containing IEDriverServer.exe and options.
 /// </summary>
 /// <param name="internetExplorerDriverServerDirectory">The full path to the directory containing IEDriverServer.exe.</param>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 public InternetExplorerDriver(string internetExplorerDriverServerDirectory, InternetExplorerOptions options)
     : this(InternetExplorerDriverService.CreateDefaultService(internetExplorerDriverServerDirectory), options)
 {
 }
 public WindowFocusInternetExplorerDriver(InternetExplorerDriverService service)
     : this(service, DefaultOptions)
 {
 }
 public WindowFocusInternetExplorerDriver(InternetExplorerDriverService service, InternetExplorerOptions options)
     : base(service, options)
 {
 }
 public InternetExplorerDriverWrapper(InternetExplorerDriverService service, InternetExplorerOptions options, TimeSpan commandTimeout)
     : base(service, options, commandTimeout)
 {
     SeleniumTestBase.LogDriverId(this, "CTOR - InternetExplorerDriver");
 }
 public InternetExplorerDriverWrapper(InternetExplorerDriverService service, InternetExplorerOptions options)
     : base(service, options)
 {
     SeleniumTestBase.LogDriverId(this, "CTOR - InternetExplorerDriver");
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the InternetExplorerDriver class with the desired options.
 /// </summary>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 public InternetExplorerDriver(InternetExplorerOptions options)
     : this(InternetExplorerDriverService.CreateDefaultService(), options, TimeSpan.FromSeconds(60))
 {
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified 
 /// <see cref="InternetExplorerDriverService"/> and options.
 /// </summary>
 /// <param name="service">The <see cref="DriverService"/> to use.</param>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 public InternetExplorerDriver(InternetExplorerDriverService service, InternetExplorerOptions options)
     : this(service, options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified path
 /// to the directory containing IEDriverServer.exe, options, and command timeout.
 /// </summary>
 /// <param name="internetExplorerDriverServerDirectory">The full path to the directory containing IEDriverServer.exe.</param>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public InternetExplorerDriver(string internetExplorerDriverServerDirectory, InternetExplorerOptions options, TimeSpan commandTimeout)
     : this(InternetExplorerDriverService.CreateDefaultService(internetExplorerDriverServerDirectory), options, commandTimeout)
 {
 }
Пример #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InternetExplorerDriver"/> class using the specified
 /// <see cref="DriverService"/>, <see cref="InternetExplorerOptions"/>, and command timeout.
 /// </summary>
 /// <param name="service">The <see cref="InternetExplorerDriverService"/> to use.</param>
 /// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public InternetExplorerDriver(InternetExplorerDriverService service, InternetExplorerOptions options, TimeSpan commandTimeout)
     : base(new DriverServiceCommandExecutor(service, commandTimeout), options.ToCapabilities())
 {
 }
Пример #18
0
 public EdgeInternetExplorerModeDriver(InternetExplorerDriverService service)
     : this(service, DefaultOptions)
 {
 }