33using System . IO ;
44using Newtonsoft . Json ;
55using NUnit . Framework ;
6- using System . Collections . Generic ;
76
87namespace OpenQA . Selenium . Environment
98{
@@ -28,15 +27,16 @@ private EnvironmentManager()
2827 string content = File . ReadAllText ( configFile ) ;
2928 TestEnvironment env = JsonConvert . DeserializeObject < TestEnvironment > ( content ) ;
3029
31- string activeDriverConfig = TestContext . Parameters . Get ( "ActiveDriverConfig" , env . ActiveDriverConfig ) ;
30+ string activeDriverConfig = System . Environment . GetEnvironmentVariable ( "ACTIVE_DRIVER_CONFIG" ) ?? TestContext . Parameters . Get ( "ActiveDriverConfig" , env . ActiveDriverConfig ) ;
31+ string driverServiceLocation = System . Environment . GetEnvironmentVariable ( "DRIVER_SERVICE_LOCATION" ) ?? TestContext . Parameters . Get ( "DriverServiceLocation" , env . DriverServiceLocation ) ;
3232 string activeWebsiteConfig = TestContext . Parameters . Get ( "ActiveWebsiteConfig" , env . ActiveWebsiteConfig ) ;
33- string driverServiceLocation = TestContext . Parameters . Get ( "DriverServiceLocation" , env . DriverServiceLocation ) ;
3433 DriverConfig driverConfig = env . DriverConfigs [ activeDriverConfig ] ;
3534 WebsiteConfig websiteConfig = env . WebSiteConfigs [ activeWebsiteConfig ] ;
3635 TestWebServerConfig webServerConfig = env . TestWebServerConfig ;
3736 webServerConfig . CaptureConsoleOutput = TestContext . Parameters . Get < bool > ( "CaptureWebServerOutput" , env . TestWebServerConfig . CaptureConsoleOutput ) ;
3837 webServerConfig . HideCommandPromptWindow = TestContext . Parameters . Get < bool > ( "HideWebServerCommandPrompt" , env . TestWebServerConfig . HideCommandPromptWindow ) ;
3938 webServerConfig . JavaHomeDirectory = TestContext . Parameters . Get ( "WebServerJavaHome" , env . TestWebServerConfig . JavaHomeDirectory ) ;
39+
4040 this . driverFactory = new DriverFactory ( driverServiceLocation ) ;
4141 this . driverFactory . DriverStarting += OnDriverStarting ;
4242
@@ -160,7 +160,7 @@ public static EnvironmentManager Instance
160160 }
161161 }
162162
163- public Browser Browser
163+ public Browser Browser
164164 {
165165 get { return browser ; }
166166 }
@@ -183,7 +183,7 @@ public string CurrentDirectory
183183 return testDirectory ;
184184 }
185185 }
186-
186+
187187 public TestWebServer WebServer
188188 {
189189 get { return webServer ; }
@@ -210,12 +210,12 @@ public UrlBuilder UrlBuilder
210210 public IWebDriver GetCurrentDriver ( )
211211 {
212212 if ( driver != null )
213- {
214- return driver ;
213+ {
214+ return driver ;
215215 }
216- else
217- {
218- return CreateFreshDriver ( ) ;
216+ else
217+ {
218+ return CreateFreshDriver ( ) ;
219219 }
220220 }
221221
@@ -238,9 +238,9 @@ public IWebDriver CreateFreshDriver()
238238
239239 public void CloseCurrentDriver ( )
240240 {
241- if ( driver != null )
241+ if ( driver != null )
242242 {
243- driver . Quit ( ) ;
243+ driver . Quit ( ) ;
244244 }
245245 driver = null ;
246246 }
0 commit comments