diff --git a/dotnet/test/common/AlertsTest.cs b/dotnet/test/common/AlertsTest.cs index 4bb6aa6814176..1e37a3b9baafc 100644 --- a/dotnet/test/common/AlertsTest.cs +++ b/dotnet/test/common/AlertsTest.cs @@ -172,7 +172,7 @@ public void ShouldAllowTheUserToGetTheTextOfAPrompt() } [Test] - public void AlertShouldNotAllowAdditionalCommandsIfDimissed() + public void AlertShouldNotAllowAdditionalCommandsIfDismissed() { driver.Url = CreateAlertPage("cheese"); diff --git a/dotnet/test/common/AvailableLogsTest.cs b/dotnet/test/common/AvailableLogsTest.cs deleted file mode 100644 index d0cdd6b42f01a..0000000000000 --- a/dotnet/test/common/AvailableLogsTest.cs +++ /dev/null @@ -1,106 +0,0 @@ -using NUnit.Framework; -using System.Collections.ObjectModel; -using OpenQA.Selenium.Remote; -using OpenQA.Selenium.Firefox; -using OpenQA.Selenium.Chrome; - -namespace OpenQA.Selenium -{ - [TestFixture] - [IgnoreBrowser(Browser.Firefox, "Firefox driver (when using Marionette/Geckodriver) does not support logs API")] - [IgnoreBrowser(Browser.IE, "IE driver does not support logs API")] - [IgnoreBrowser(Browser.Safari, "Edge driver does not support logs API")] - public class AvailableLogsTest : DriverTestFixture - { - private IWebDriver localDriver; - - [TearDown] - public void QuitDriver() - { - if (localDriver != null) - { - localDriver.Quit(); - localDriver = null; - } - } - - //[Test] - public void BrowserLogShouldBeEnabledByDefault() - { - ReadOnlyCollection logTypes = driver.Manage().Logs.AvailableLogTypes; - Assert.That(logTypes, Contains.Item(LogType.Browser)); - } - - //[Test] - [Ignore("Client log doesn't exist yet in .NET bindings")] - [NeedsFreshDriver(IsCreatedBeforeTest = true)] - public void ClientLogShouldBeEnabledByDefault() - { - // Do one action to have *something* in the client logs. - driver.Url = formsPage; - ReadOnlyCollection logTypes = driver.Manage().Logs.AvailableLogTypes; - Assert.That(logTypes, Contains.Item(LogType.Client)); - bool foundExecutingStatement = false; - bool foundExecutedStatement = false; - foreach (LogEntry logEntry in driver.Manage().Logs.GetLog(LogType.Client)) - { - foundExecutingStatement |= logEntry.ToString().Contains("Executing: "); - foundExecutedStatement |= logEntry.ToString().Contains("Executed: "); - } - - Assert.That(foundExecutingStatement, Is.True); - Assert.That(foundExecutedStatement, Is.True); - } - - //[Test] - public void DriverLogShouldBeEnabledByDefault() - { - ReadOnlyCollection logTypes = driver.Manage().Logs.AvailableLogTypes; - Assert.That(logTypes, Contains.Item(LogType.Driver), "Remote driver logs should be enabled by default"); - } - - //[Test] - public void ProfilerLogShouldBeDisabledByDefault() - { - ReadOnlyCollection logTypes = driver.Manage().Logs.AvailableLogTypes; - Assert.That(logTypes, Has.No.Member(LogType.Profiler), "Profiler logs should not be enabled by default"); - } - - //[Test] - [IgnoreBrowser(Browser.Chrome, "Chrome does not support profiler logs")] - [IgnoreBrowser(Browser.Edge, "Edge does not support profiler logs")] - public void ShouldBeAbleToEnableProfilerLog() - { - CreateWebDriverWithProfiling(); - ReadOnlyCollection logTypes = localDriver.Manage().Logs.AvailableLogTypes; - Assert.That(logTypes, Contains.Item(LogType.Profiler), "Profiler log should be enabled"); - } - - //[Test] - [Ignore("No way to determine remote only")] - public void ServerLogShouldBeEnabledByDefaultOnRemote() - { - //assumeTrue(Boolean.getBoolean("selenium.browser.remote")); - - ReadOnlyCollection logTypes = localDriver.Manage().Logs.AvailableLogTypes; - Assert.That(logTypes, Contains.Item(LogType.Server), "Server logs should be enabled by default"); - } - - private void CreateWebDriverWithProfiling() - { - if (TestUtilities.IsFirefox(driver)) - { - FirefoxOptions options = new FirefoxOptions(); - options.AddAdditionalOption(CapabilityType.EnableProfiling, true); - localDriver = new FirefoxDriver(options); - } - else if (TestUtilities.IsChrome(driver)) - { - ChromeOptions options = new ChromeOptions(); - options.AddAdditionalOption(CapabilityType.EnableProfiling, true); - localDriver = new ChromeDriver(options); - ICapabilities c = ((IHasCapabilities)localDriver).Capabilities; - } - } - } -} diff --git a/dotnet/test/common/CustomDriverConfigs/DefaultSafariDriver.cs b/dotnet/test/common/CustomDriverConfigs/DefaultSafariDriver.cs index eadc7ef556319..2272dd6ec0051 100644 --- a/dotnet/test/common/CustomDriverConfigs/DefaultSafariDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/DefaultSafariDriver.cs @@ -6,18 +6,19 @@ namespace OpenQA.Selenium.Safari public class DefaultSafariDriver : SafariDriver { public DefaultSafariDriver() - : this(DefaultService, new SafariOptions()) + : base(DefaultOptions) { } - public DefaultSafariDriver(SafariDriverService service, SafariOptions options) - : base(service, options) + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public DefaultSafariDriver(SafariOptions options) + : base(options) { } - public static SafariDriverService DefaultService + public static SafariOptions DefaultOptions { - get { return SafariDriverService.CreateDefaultService("/usr/bin"); } + get { return new SafariOptions(); } } } } diff --git a/dotnet/test/common/CustomDriverConfigs/DevChannelChromeDriver.cs b/dotnet/test/common/CustomDriverConfigs/DevChannelChromeDriver.cs index 1108d003db48f..14b1c38fff16a 100644 --- a/dotnet/test/common/CustomDriverConfigs/DevChannelChromeDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/DevChannelChromeDriver.cs @@ -1,28 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - namespace OpenQA.Selenium.Chrome { public class DevChannelChromeDriver : ChromeDriver { - public DevChannelChromeDriver(ChromeDriverService service) - : this(service, DefaultOptions) + public DevChannelChromeDriver() + : base(DefaultOptions) { } - public DevChannelChromeDriver(ChromeDriverService service, ChromeOptions options) - : base(service, options) + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public DevChannelChromeDriver(ChromeOptions options) + : base(options) { } public static ChromeOptions DefaultOptions { - // The below path to the Chrome Developer Channel executable is obviously hard-coded. - // On non-Windows OSes, and for custom install locations, you will need to add a - // property to the below options: BinaryLocation = - get { return new ChromeOptions() { BinaryLocation = @"C:\Program Files (x86)\Google\Chrome Dev\Application\chrome.exe", AcceptInsecureCertificates = true }; } + get { return new ChromeOptions() { BrowserVersion = "dev" }; } } } } diff --git a/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs b/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs index b48844262ceda..5f836089c6411 100644 --- a/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs @@ -1,51 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace OpenQA.Selenium.Edge { public class DevChannelEdgeDriver : EdgeDriver { - private static string servicePath = string.Empty; - public DevChannelEdgeDriver() - : this(DefaultService, DefaultOptions) + : base(DefaultOptions) { } - public DevChannelEdgeDriver(EdgeDriverService service, EdgeOptions options) - : base(service, options) + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public DevChannelEdgeDriver(EdgeOptions options) + : base(options) { } public static EdgeOptions DefaultOptions { - get { - // The below path to the Edge Developer Channel executable is obviously hard-coded. - // On non-Windows OSes, and for custom install locations, you will need to add a - // property to the below options: BinaryLocation = - return new EdgeOptions() - { - BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe" - }; - } - } - - public static EdgeDriverService DefaultService - { - get - { - EdgeDriverService service = EdgeDriverService.CreateDefaultService(ServicePath); - return service; - } - } - - public static string ServicePath - { - get { return servicePath; } - set { servicePath = value; } + get { return new EdgeOptions() { BrowserVersion = "dev" }; } } } } diff --git a/dotnet/test/common/CustomDriverConfigs/EdgeInternetExplorerModeDriver.cs b/dotnet/test/common/CustomDriverConfigs/EdgeInternetExplorerModeDriver.cs index 59d3377a3866b..ae28d74a1a71d 100644 --- a/dotnet/test/common/CustomDriverConfigs/EdgeInternetExplorerModeDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/EdgeInternetExplorerModeDriver.cs @@ -1,55 +1,24 @@ -using OpenQA.Selenium.Remote; - namespace OpenQA.Selenium.IE { // This is a simple wrapper class to create an InternetExplorerDriver that // uses the enables RequireWindowFocus as the default input simplation. public class EdgeInternetExplorerModeDriver : InternetExplorerDriver { - private static string servicePath = string.Empty; - - public EdgeInternetExplorerModeDriver(InternetExplorerDriverService service) - : this(service, DefaultOptions) - { - } - public EdgeInternetExplorerModeDriver(InternetExplorerDriverService service, InternetExplorerOptions options) - : base(service, options) + public EdgeInternetExplorerModeDriver() + : base(DefaultOptions) { } - public static string ServicePath + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public EdgeInternetExplorerModeDriver(InternetExplorerOptions options) + : base(options) { - get { return servicePath; } - set { servicePath = value; } - } - - public static InternetExplorerDriverService DefaultService - { - get - { - InternetExplorerDriverService service; - if (string.IsNullOrEmpty(servicePath)) - { - service = InternetExplorerDriverService.CreateDefaultService(); - } - else - { - service = InternetExplorerDriverService.CreateDefaultService(servicePath); - } - - // For debugging purposes, one can uncomment the following lines - // to generate a log from the driver executable. Please do not - // commit changes to this file with these lines uncommented. - // service.LogFile = @"iedriver.log"; - // service.LoggingLevel = InternetExplorerDriverLogLevel.Debug; - return service; - } } public static InternetExplorerOptions DefaultOptions { - get { return new InternetExplorerOptions() { RequireWindowFocus = true, UsePerProcessProxy = true, AttachToEdgeChrome = true, EdgeExecutablePath = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" }; } + get { return new InternetExplorerOptions() { RequireWindowFocus = true, UsePerProcessProxy = true, AttachToEdgeChrome = true }; } } } } diff --git a/dotnet/test/common/CustomDriverConfigs/NightlyChannelFirefoxDriver.cs b/dotnet/test/common/CustomDriverConfigs/NightlyChannelFirefoxDriver.cs index b30ff064b5079..3c0706f8648fa 100644 --- a/dotnet/test/common/CustomDriverConfigs/NightlyChannelFirefoxDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/NightlyChannelFirefoxDriver.cs @@ -1,5 +1,3 @@ -using OpenQA.Selenium.Remote; - namespace OpenQA.Selenium.Firefox { // This is a simple wrapper class to create a FirefoxDriver that @@ -7,22 +5,20 @@ namespace OpenQA.Selenium.Firefox // constructor. public class NightlyChannelFirefoxDriver : FirefoxDriver { - public NightlyChannelFirefoxDriver(FirefoxDriverService service) - : this(service, DefaultOptions) + public NightlyChannelFirefoxDriver() + : base(DefaultOptions) { } - public NightlyChannelFirefoxDriver(FirefoxDriverService service, FirefoxOptions options) - : base(service, options) + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public NightlyChannelFirefoxDriver(FirefoxOptions options) + : base(options) { } public static FirefoxOptions DefaultOptions { - // The below path to the Firefox Nightly Channel executable is obviously hard-coded. - // On non-Windows OSes, and for custom install locations, you will need to add a - // property to the below options: BrowserExecutableLocation = - get { return new FirefoxOptions() { BrowserExecutableLocation = @"C:\Program Files\Firefox Nightly\firefox.exe", AcceptInsecureCertificates = true }; } + get { return new FirefoxOptions() { BrowserVersion = "nightly" }; } } } } diff --git a/dotnet/test/common/CustomDriverConfigs/SafariTechnologyPreviewDriver.cs b/dotnet/test/common/CustomDriverConfigs/SafariTechnologyPreviewDriver.cs index 01b51bf09b6b8..14cb2f3f9161f 100644 --- a/dotnet/test/common/CustomDriverConfigs/SafariTechnologyPreviewDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/SafariTechnologyPreviewDriver.cs @@ -6,20 +6,16 @@ namespace OpenQA.Selenium.Safari public class SafariTechnologyPreviewDriver : SafariDriver { public SafariTechnologyPreviewDriver() - : this(DefaultService, DefaultOptions) + : base(DefaultOptions) { } - public SafariTechnologyPreviewDriver(SafariDriverService service, SafariOptions options) - : base(service, options) + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public SafariTechnologyPreviewDriver(SafariOptions options) + : base(options) { } - public static SafariDriverService DefaultService - { - get { return SafariDriverService.CreateDefaultService("/Applications/Safari Technology Preview.app/Contents/MacOS"); } - } - public static SafariOptions DefaultOptions { get { return new SafariOptions(); } diff --git a/dotnet/test/common/CustomDriverConfigs/StableChannelChromeDriver.cs b/dotnet/test/common/CustomDriverConfigs/StableChannelChromeDriver.cs index cff9dccb44653..e6fda71d92cc1 100644 --- a/dotnet/test/common/CustomDriverConfigs/StableChannelChromeDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/StableChannelChromeDriver.cs @@ -1,14 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - namespace OpenQA.Selenium.Chrome { public class StableChannelChromeDriver : ChromeDriver { - public StableChannelChromeDriver(ChromeDriverService service, ChromeOptions options) - : base(service, options) + public StableChannelChromeDriver() + : base(DefaultOptions) + { + } + + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public StableChannelChromeDriver(ChromeOptions options) + : base(options) { } diff --git a/dotnet/test/common/CustomDriverConfigs/StableChannelEdgeDriver.cs b/dotnet/test/common/CustomDriverConfigs/StableChannelEdgeDriver.cs index 6f28539afd623..a12af840d469b 100644 --- a/dotnet/test/common/CustomDriverConfigs/StableChannelEdgeDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/StableChannelEdgeDriver.cs @@ -1,51 +1,22 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace OpenQA.Selenium.Edge { public class StableChannelEdgeDriver : EdgeDriver { - private static string servicePath = string.Empty; public StableChannelEdgeDriver() - : this(DefaultService, DefaultOptions) + : base(DefaultOptions) { } - public StableChannelEdgeDriver(EdgeDriverService service, EdgeOptions options) - : base(service, options) + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public StableChannelEdgeDriver(EdgeOptions options) + : base(options) { } public static EdgeOptions DefaultOptions { - get { - // The below path to the Edge Developer Channel executable is obviously hard-coded. - // On non-Windows OSes, and for custom install locations, you will need to add a - // property to the below options: BinaryLocation = - return new EdgeOptions() - { - BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" - }; - } - } - - public static EdgeDriverService DefaultService - { - get - { - EdgeDriverService service = EdgeDriverService.CreateDefaultService(ServicePath); - return service; - } - } - - public static string ServicePath - { - get { return servicePath; } - set { servicePath = value; } + get { return new EdgeOptions(); } } } } diff --git a/dotnet/test/common/CustomDriverConfigs/StableChannelFirefoxDriver.cs b/dotnet/test/common/CustomDriverConfigs/StableChannelFirefoxDriver.cs index ccfd5ec202f5c..1c3c7d6af72d1 100644 --- a/dotnet/test/common/CustomDriverConfigs/StableChannelFirefoxDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/StableChannelFirefoxDriver.cs @@ -7,20 +7,19 @@ namespace OpenQA.Selenium.Firefox // constructor. public class StableChannelFirefoxDriver : FirefoxDriver { - public StableChannelFirefoxDriver(FirefoxDriverService service) - : this(service, DefaultOptions) + public StableChannelFirefoxDriver() + : base(DefaultOptions) { } - public StableChannelFirefoxDriver(FirefoxDriverService service, FirefoxOptions options) - : base(service, options, RemoteWebDriver.DefaultCommandTimeout) + // Required for dynamic setting with `EnvironmentManager.Instance.CreateDriverInstance(options)` + public StableChannelFirefoxDriver(FirefoxOptions options) + : base(options) { } public static FirefoxOptions DefaultOptions { - // If you are running with Firefox installed to a custom location, you will need - // to add a property to the below options: BrowserExecutableLocation = get { return new FirefoxOptions() { AcceptInsecureCertificates = true }; } } } diff --git a/dotnet/test/common/CustomDriverConfigs/StableChannelRemoteChromeDriver.cs b/dotnet/test/common/CustomDriverConfigs/StableChannelRemoteChromeDriver.cs index 9c55dffad0640..b7737dd4825d2 100644 --- a/dotnet/test/common/CustomDriverConfigs/StableChannelRemoteChromeDriver.cs +++ b/dotnet/test/common/CustomDriverConfigs/StableChannelRemoteChromeDriver.cs @@ -1,9 +1,5 @@ using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Remote; using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; namespace OpenQA.Selenium.Remote { diff --git a/dotnet/test/common/CustomDriverConfigs/WindowFocusInternetExplorerDriver.cs b/dotnet/test/common/CustomDriverConfigs/WindowFocusInternetExplorerDriver.cs deleted file mode 100644 index b08d0bf49927d..0000000000000 --- a/dotnet/test/common/CustomDriverConfigs/WindowFocusInternetExplorerDriver.cs +++ /dev/null @@ -1,55 +0,0 @@ -using OpenQA.Selenium.Remote; - -namespace OpenQA.Selenium.IE -{ - // This is a simple wrapper class to create an InternetExplorerDriver that - // uses the enables RequireWindowFocus as the default input simplation. - public class WindowFocusInternetExplorerDriver : InternetExplorerDriver - { - private static string servicePath = string.Empty; - - public WindowFocusInternetExplorerDriver(InternetExplorerDriverService service) - : this(service, DefaultOptions) - { - } - - public WindowFocusInternetExplorerDriver(InternetExplorerDriverService service, InternetExplorerOptions options) - : base(service, options) - { - } - - public static string ServicePath - { - get { return servicePath; } - set { servicePath = value; } - } - - public static InternetExplorerDriverService DefaultService - { - get - { - InternetExplorerDriverService service; - if (string.IsNullOrEmpty(servicePath)) - { - service = InternetExplorerDriverService.CreateDefaultService(); - } - else - { - service = InternetExplorerDriverService.CreateDefaultService(servicePath); - } - - // For debugging purposes, one can uncomment the following lines - // to generate a log from the driver executable. Please do not - // commit changes to this file with these lines uncommented. - // service.LogFile = @"iedriver.log"; - // service.LoggingLevel = InternetExplorerDriverLogLevel.Debug; - return service; - } - } - - public static InternetExplorerOptions DefaultOptions - { - get { return new InternetExplorerOptions() { RequireWindowFocus = true, UsePerProcessProxy = true }; } - } - } -} diff --git a/dotnet/test/common/Environment/DriverFactory.cs b/dotnet/test/common/Environment/DriverFactory.cs index 9add4e74be505..b5b2256d62d35 100644 --- a/dotnet/test/common/Environment/DriverFactory.cs +++ b/dotnet/test/common/Environment/DriverFactory.cs @@ -1,4 +1,3 @@ -using NUnit.Framework; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Edge; using OpenQA.Selenium.Firefox; @@ -12,22 +11,10 @@ namespace OpenQA.Selenium.Environment { public class DriverFactory { - string driverPath; - private Dictionary serviceTypes = new Dictionary(); private Dictionary optionsTypes = new Dictionary(); - public DriverFactory(string driverPath) + public DriverFactory() { - if (string.IsNullOrEmpty(driverPath)) - { - this.driverPath = TestContext.CurrentContext.TestDirectory; - } - else - { - this.driverPath = driverPath; - } - - this.PopulateServiceTypes(); this.PopulateOptionsTypes(); } @@ -40,22 +27,8 @@ private void PopulateOptionsTypes() this.optionsTypes[Browser.Safari] = typeof(SafariOptions); } - private void PopulateServiceTypes() - { - this.serviceTypes[Browser.Chrome] = typeof(ChromeDriverService); - this.serviceTypes[Browser.Edge] = typeof(EdgeDriverService); - this.serviceTypes[Browser.Firefox] = typeof(FirefoxDriverService); - this.serviceTypes[Browser.IE] = typeof(InternetExplorerDriverService); - this.serviceTypes[Browser.Safari] = typeof(SafariDriverService); - } - public event EventHandler DriverStarting; - public string DriverServicePath - { - get { return this.driverPath; } - } - public IWebDriver CreateDriver(Type driverType) { return CreateDriverWithOptions(driverType, null); @@ -64,7 +37,6 @@ public IWebDriver CreateDriver(Type driverType) public IWebDriver CreateDriverWithOptions(Type driverType, DriverOptions driverOptions) { Browser browser = Browser.All; - DriverService service = null; DriverOptions options = null; List constructorArgTypeList = new List(); @@ -73,49 +45,44 @@ public IWebDriver CreateDriverWithOptions(Type driverType, DriverOptions driverO { browser = Browser.Chrome; options = GetDriverOptions(driverType, driverOptions); - service = CreateService(driverType); } else if (typeof(InternetExplorerDriver).IsAssignableFrom(driverType)) { browser = Browser.IE; options = GetDriverOptions(driverType, driverOptions); - service = CreateService(driverType); } else if (typeof(FirefoxDriver).IsAssignableFrom(driverType)) { browser = Browser.Firefox; options = GetDriverOptions(driverType, driverOptions); - service = CreateService(driverType); } else if (typeof(SafariDriver).IsAssignableFrom(driverType)) { browser = Browser.Safari; options = GetDriverOptions(driverType, driverOptions); - service = CreateService(driverType); } - this.OnDriverLaunching(service, options); + this.OnDriverLaunching(options); if (browser != Browser.All) { - constructorArgTypeList.Add(this.serviceTypes[browser]); constructorArgTypeList.Add(this.optionsTypes[browser]); ConstructorInfo ctorInfo = driverType.GetConstructor(constructorArgTypeList.ToArray()); if (ctorInfo != null) { - return (IWebDriver)ctorInfo.Invoke(new object[] { service, options }); + return (IWebDriver)ctorInfo.Invoke(new object[] { options }); } } - driver = (IWebDriver)Activator.CreateInstance(driverType); + driver = (IWebDriver)Activator.CreateInstance(driverType, options); return driver; } - protected void OnDriverLaunching(DriverService service, DriverOptions options) + protected void OnDriverLaunching(DriverOptions options) { if (this.DriverStarting != null) { - DriverStartingEventArgs args = new DriverStartingEventArgs(service, options); + DriverStartingEventArgs args = new DriverStartingEventArgs(options); this.DriverStarting(this, args); } } @@ -164,39 +131,6 @@ protected void OnDriverLaunching(DriverService service, DriverOptions options) return mergedOptions; } - private T CreateService(Type driverType) where T:DriverService - { - T service = default(T); - Type serviceType = typeof(T); - - // If the driver type has a static DefaultService property, - // get the value of that property, which should be a valid - // service of the generic type (T). Otherwise, invoke the - // static CreateDefaultService method on the driver service's - // type, which returns an instance of the type. - PropertyInfo defaultServiceProperty = driverType.GetProperty("DefaultService", BindingFlags.Public | BindingFlags.Static); - if (defaultServiceProperty != null && defaultServiceProperty.PropertyType == serviceType) - { - PropertyInfo servicePathProperty = driverType.GetProperty("ServicePath", BindingFlags.Public | BindingFlags.Static); - if (servicePathProperty != null) - { - servicePathProperty.SetValue(null, this.driverPath); - } - - service = (T)defaultServiceProperty.GetValue(null, null); - } - else - { - MethodInfo createDefaultServiceMethod = serviceType.GetMethod("CreateDefaultService", BindingFlags.Public | BindingFlags.Static, null, new Type[] { typeof(string) }, null); - if (createDefaultServiceMethod != null && createDefaultServiceMethod.ReturnType == serviceType) - { - service = (T)createDefaultServiceMethod.Invoke(null, new object[] { this.driverPath }); - } - } - - return service; - } - private object GetDefaultOptions(Type driverType) { PropertyInfo info = driverType.GetProperty("DefaultOptions", BindingFlags.Public | BindingFlags.Static); diff --git a/dotnet/test/common/Environment/DriverStartingEventArgs.cs b/dotnet/test/common/Environment/DriverStartingEventArgs.cs index d577ec0b4bbff..cfb4570091cf3 100644 --- a/dotnet/test/common/Environment/DriverStartingEventArgs.cs +++ b/dotnet/test/common/Environment/DriverStartingEventArgs.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace OpenQA.Selenium.Environment { public class DriverStartingEventArgs @@ -11,9 +5,8 @@ public class DriverStartingEventArgs DriverService service; DriverOptions options; - public DriverStartingEventArgs(DriverService service, DriverOptions options) + public DriverStartingEventArgs(DriverOptions options) { - this.Service = service; this.Options = options; } diff --git a/dotnet/test/common/Environment/EnvironmentManager.cs b/dotnet/test/common/Environment/EnvironmentManager.cs index 62e525ded93b4..8e79e220dca13 100644 --- a/dotnet/test/common/Environment/EnvironmentManager.cs +++ b/dotnet/test/common/Environment/EnvironmentManager.cs @@ -28,7 +28,6 @@ private EnvironmentManager() TestEnvironment env = JsonConvert.DeserializeObject(content); string activeDriverConfig = System.Environment.GetEnvironmentVariable("ACTIVE_DRIVER_CONFIG") ?? TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig); - string driverServiceLocation = System.Environment.GetEnvironmentVariable("DRIVER_SERVICE_LOCATION") ?? TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation); string activeWebsiteConfig = TestContext.Parameters.Get("ActiveWebsiteConfig", env.ActiveWebsiteConfig); DriverConfig driverConfig = env.DriverConfigs[activeDriverConfig]; WebsiteConfig websiteConfig = env.WebSiteConfigs[activeWebsiteConfig]; @@ -37,7 +36,7 @@ private EnvironmentManager() webServerConfig.HideCommandPromptWindow = TestContext.Parameters.Get("HideWebServerCommandPrompt", env.TestWebServerConfig.HideCommandPromptWindow); webServerConfig.JavaHomeDirectory = TestContext.Parameters.Get("WebServerJavaHome", env.TestWebServerConfig.JavaHomeDirectory); - this.driverFactory = new DriverFactory(driverServiceLocation); + this.driverFactory = new DriverFactory(); this.driverFactory.DriverStarting += OnDriverStarting; Assembly driverAssembly = null; @@ -165,11 +164,6 @@ public Browser Browser get { return browser; } } - public string DriverServiceDirectory - { - get { return this.driverFactory.DriverServicePath; } - } - public string CurrentDirectory { get diff --git a/dotnet/test/common/Environment/RemoteSeleniumServer.cs b/dotnet/test/common/Environment/RemoteSeleniumServer.cs index 5ad7c2871e09c..774cb82447640 100644 --- a/dotnet/test/common/Environment/RemoteSeleniumServer.cs +++ b/dotnet/test/common/Environment/RemoteSeleniumServer.cs @@ -32,23 +32,10 @@ public void Start() "go //java/src/org/openqa/grid/selenium:selenium")); } - string serviceDirectory = EnvironmentManager.Instance.DriverServiceDirectory; - if (string.IsNullOrEmpty(serviceDirectory)) - { - serviceDirectory = EnvironmentManager.Instance.CurrentDirectory; - } - - string ieDriverExe = System.IO.Path.Combine(serviceDirectory, "IEDriverServer.exe"); - string chromeDriverExe = System.IO.Path.Combine(serviceDirectory, "chromedriver.exe"); - string geckoDriverExe = System.IO.Path.Combine(serviceDirectory, "geckodriver.exe"); - string edgeDriverExe = System.IO.Path.Combine(serviceDirectory, "msedgedriver.exe"); webserverProcess = new Process(); webserverProcess.StartInfo.FileName = "java.exe"; - webserverProcess.StartInfo.Arguments = "-Dwebdriver.ie.driver=" + ieDriverExe - + " -Dwebdriver.gecko.driver=" + geckoDriverExe - + " -Dwebdriver.chrome.driver=" + chromeDriverExe - + " -Dwebdriver.edge.driver=" + edgeDriverExe - + " -jar " + serverJarName + " standalone --port 6000"; + webserverProcess.StartInfo.Arguments = " -jar " + serverJarName + + " standalone --port 6000 --selenium-manager true"; webserverProcess.StartInfo.WorkingDirectory = projectRootPath; webserverProcess.Start(); DateTime timeout = DateTime.Now.Add(TimeSpan.FromSeconds(30)); diff --git a/dotnet/test/common/Environment/TestEnvironment.cs b/dotnet/test/common/Environment/TestEnvironment.cs index bfd8e2e83fe6b..95ab14df89224 100644 --- a/dotnet/test/common/Environment/TestEnvironment.cs +++ b/dotnet/test/common/Environment/TestEnvironment.cs @@ -1,9 +1,5 @@ using Newtonsoft.Json; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace OpenQA.Selenium.Environment { @@ -16,9 +12,6 @@ class TestEnvironment [JsonProperty] public bool HideWebServerCommandPrompt { get; set; } - [JsonProperty] - public string DriverServiceLocation { get; set; } - [JsonProperty] public string ActiveDriverConfig { get; set; } diff --git a/dotnet/test/common/GetLogsTest.cs b/dotnet/test/common/GetLogsTest.cs index 0d2ace053d1a3..eec776998b668 100644 --- a/dotnet/test/common/GetLogsTest.cs +++ b/dotnet/test/common/GetLogsTest.cs @@ -82,10 +82,9 @@ private void CreateWebDriverWithLogging(string logType, LogLevel logLevel) { if (TestUtilities.IsChrome(driver)) { - ChromeDriverService service = ChromeDriverService.CreateDefaultService(EnvironmentManager.Instance.DriverServiceDirectory); ChromeOptions options = new ChromeOptions(); options.SetLoggingPreference(logType, logLevel); - localDriver = new ChromeDriver(service, options); + localDriver = new ChromeDriver(options); } localDriver.Url = simpleTestPage; diff --git a/dotnet/test/common/PageLoadingTest.cs b/dotnet/test/common/PageLoadingTest.cs index 888a752ae86e7..f1c13a7881e48 100644 --- a/dotnet/test/common/PageLoadingTest.cs +++ b/dotnet/test/common/PageLoadingTest.cs @@ -64,7 +64,6 @@ public void NoneStrategyShouldNotWaitForPageToRefresh() } [Test] - [IgnoreBrowser(Browser.Edge, "Edge driver does not support eager page load strategy")] public void EagerStrategyShouldNotWaitForResources() { InitLocalDriver(PageLoadStrategy.Eager); @@ -85,7 +84,6 @@ public void EagerStrategyShouldNotWaitForResources() } [Test] - [IgnoreBrowser(Browser.Edge, "Edge driver does not support eager page load strategy")] public void EagerStrategyShouldNotWaitForResourcesOnRefresh() { InitLocalDriver(PageLoadStrategy.Eager); @@ -111,7 +109,6 @@ public void EagerStrategyShouldNotWaitForResourcesOnRefresh() } [Test] - [IgnoreBrowser(Browser.Edge, "Edge driver does not support eager page load strategy")] public void EagerStrategyShouldWaitForDocumentToBeLoaded() { InitLocalDriver(PageLoadStrategy.Eager); diff --git a/dotnet/test/common/appconfig.json b/dotnet/test/common/appconfig.json index 728b1da44b514..41f2c3d64a5a8 100644 --- a/dotnet/test/common/appconfig.json +++ b/dotnet/test/common/appconfig.json @@ -1,5 +1,4 @@ { - "DriverServiceLocation": "C:\\Projects\\WebDriverServers", "ActiveDriverConfig": "Chrome", "ActiveWebsiteConfig": "Default", "TestWebServerConfig": { @@ -38,13 +37,6 @@ "RemoteCapabilities": "chrome" }, - "IE": { - "DriverTypeName": "OpenQA.Selenium.IE.WindowFocusInternetExplorerDriver", - "AssemblyName": "WebDriver.Common.Tests", - "BrowserValue": "IE", - "RemoteCapabilities": "internet explorer" - }, - "EdgeIEMode": { "DriverTypeName": "OpenQA.Selenium.IE.EdgeInternetExplorerModeDriver", "AssemblyName": "WebDriver.Common.Tests",