diff --git a/Ocaramba.Tests.NUnit/appsettings.json b/Ocaramba.Tests.NUnit/appsettings.json index 961921505..90833f76a 100644 --- a/Ocaramba.Tests.NUnit/appsettings.json +++ b/Ocaramba.Tests.NUnit/appsettings.json @@ -16,6 +16,7 @@ "FirefoxUseLegacyImplementation": "false", "PathToFirefoxProfile": "", "RemoteWebDriverHub": "http://localhost:4444/wd/hub", + "remoteTimeout": "300", "DriverCapabilities": "Chrome", "longTimeout": "30", "mediumTimeout": "10", diff --git a/OcarambaLite/BaseConfiguration.cs b/OcarambaLite/BaseConfiguration.cs index 42e506e07..19128a99d 100644 --- a/OcarambaLite/BaseConfiguration.cs +++ b/OcarambaLite/BaseConfiguration.cs @@ -302,15 +302,22 @@ public static TimeSpan RemoteWebDriverTimeout { get { - int setting = 0; + string setting = null; #if net47 - setting = int.Parse(ConfigurationManager.AppSettings["remoteTimeout"], CultureInfo.InvariantCulture); + setting = ConfigurationManager.AppSettings["remoteTimeout"]; #endif #if net6_0 - setting = int.Parse(Builder["appSettings:remoteTimeout"], CultureInfo.InvariantCulture); + setting = Builder["appSettings:remoteTimeout"]; #endif - Logger.Trace(CultureInfo.CurrentCulture, "Gets the remote timeout from settings file '{0}'", setting); - return new TimeSpan(0, 0, setting); + if (string.IsNullOrEmpty(setting)) + { + setting = "300"; + } + + var timeout = int.Parse(setting, CultureInfo.InvariantCulture); + + Logger.Trace(CultureInfo.CurrentCulture, "Gets the remote timeout from settings file '{0}'", timeout); + return new TimeSpan(0, 0, timeout); } } diff --git a/OcarambaLite/DriverContext.cs b/OcarambaLite/DriverContext.cs index 9fa755f13..d5d04f181 100644 --- a/OcarambaLite/DriverContext.cs +++ b/OcarambaLite/DriverContext.cs @@ -624,7 +624,7 @@ public void Start() this.serviceChrome = ChromeDriverService.CreateDefaultService(); this.serviceChrome.LogPath = BaseConfiguration.PathToChromeDriverLog; this.serviceChrome.EnableVerboseLogging = BaseConfiguration.EnableVerboseLoggingChrome; - this.driver = string.IsNullOrEmpty(BaseConfiguration.PathToChromeDriverDirectory) ? new ChromeDriver(this.serviceChrome, this.SetDriverOptions(this.ChromeOptions)) : new ChromeDriver(BaseConfiguration.PathToChromeDriverDirectory, this.SetDriverOptions(this.ChromeOptions)); + this.driver = string.IsNullOrEmpty(BaseConfiguration.PathToChromeDriverDirectory) ? new ChromeDriver(this.serviceChrome, this.SetDriverOptions(this.ChromeOptions), BaseConfiguration.RemoteWebDriverTimeout) : new ChromeDriver(BaseConfiguration.PathToChromeDriverDirectory, this.SetDriverOptions(this.ChromeOptions), BaseConfiguration.RemoteWebDriverTimeout); break; case BrowserType.Safari: this.driver = new SafariDriver(this.SetDriverOptions(this.SafariOptions)); @@ -641,7 +641,7 @@ public void Start() } this.serviceEdge = EdgeDriverService.CreateDefaultService(); - this.driver = string.IsNullOrEmpty(BaseConfiguration.PathToEdgeChromiumDriverDirectory) ? new EdgeDriver(this.serviceEdge, this.SetDriverOptions(this.EdgeOptions)) : new EdgeDriver(EdgeDriverService.CreateDefaultService(BaseConfiguration.PathToEdgeChromiumDriverDirectory, @"msedgedriver.exe"), this.SetDriverOptions(this.EdgeOptions)); + this.driver = string.IsNullOrEmpty(BaseConfiguration.PathToEdgeChromiumDriverDirectory) ? new EdgeDriver(this.serviceEdge, this.SetDriverOptions(this.EdgeOptions), BaseConfiguration.RemoteWebDriverTimeout) : new EdgeDriver(EdgeDriverService.CreateDefaultService(BaseConfiguration.PathToEdgeChromiumDriverDirectory, @"msedgedriver.exe"), this.SetDriverOptions(this.EdgeOptions), BaseConfiguration.RemoteWebDriverTimeout); break; default: throw new NotSupportedException(