@@ -13,12 +13,12 @@ public class BrowserData : IEnumerable<object[]>
1313    { 
1414        private  readonly  List < object [ ] >  _data  =  new  List < object [ ] > 
1515        { 
16-             new  object [ ]  { new  ChromeConfig ( ) ,  DriverType . Chrome } , 
17- //            new object[] {new EdgeConfig(), DriverType.Edge}, 
18-             new  object [ ]  { new  FirefoxConfig ( ) ,  DriverType . Firefox } , 
19-             new  object [ ]  { new  InternetExplorerConfig ( ) ,  DriverType . InternetExplorer } , 
20- //            new object[] {new OperaConfig(), DriverType.Opera}, 
21-             new  object [ ]  { new  PhantomConfig ( ) ,  DriverType . Phantom } 
16+             new  object [ ]  { new  ChromeConfig ( ) ,  DriverType . Chrome ,   "chromedriver" } , 
17+ //            new object[] {new EdgeConfig(), DriverType.Edge, "MicrosoftWebDriver" }, 
18+             new  object [ ]  { new  FirefoxConfig ( ) ,  DriverType . Firefox ,   "geckodriver" } , 
19+             new  object [ ]  { new  InternetExplorerConfig ( ) ,  DriverType . InternetExplorer ,   "IEDriverServer" } , 
20+ //            new object[] {new OperaConfig(), DriverType.Opera, "operadriver" }, 
21+             new  object [ ]  { new  PhantomConfig ( ) ,  DriverType . Phantom ,   "phantomjs" } 
2222        } ; 
2323
2424        public  IEnumerator < object [ ] >  GetEnumerator ( ) 
@@ -35,20 +35,39 @@ IEnumerator IEnumerable.GetEnumerator()
3535    public  class  BrowserTests  :  IDisposable 
3636    { 
3737        private  IWebDriver  _webDriver ; 
38+         private  string  _driverExe ; 
3839
3940        [ Theory ,  ClassData ( typeof ( BrowserData ) ) ,  Trait ( "Category" ,  "Browser" ) ] 
40-         protected  void  BrowserTest ( IDriverConfig  driverConfig ,  DriverType  driverType ) 
41+         protected  void  BrowserTest ( IDriverConfig  driverConfig ,  DriverType  driverType ,   string   driverExe ) 
4142        { 
42-             new  DriverManager ( ) . SetUpDriver ( driverConfig ) ; 
43+             _driverExe  =  driverExe ; 
44+             if  ( driverType  ==  DriverType . Phantom ) 
45+             { 
46+                 new  DriverManager ( ) . SetUpDriver ( driverConfig ,  "2.1.1" ) ; 
47+             } 
48+             else 
49+             { 
50+                 new  DriverManager ( ) . SetUpDriver ( driverConfig ) ; 
51+             } 
4352            _webDriver  =  new  DriverCreator ( ) . Create ( driverType ) ; 
4453            _webDriver . Navigate ( ) . GoToUrl ( "https://www.wikipedia.org" ) ; 
45-             _webDriver . Navigate ( ) . GoToUrl ( "https://www.wikipedia.org" ) ; 
4654            Assert . Equal ( "Wikipedia" ,  _webDriver . Title ) ; 
4755        } 
4856
4957        public  void  Dispose ( ) 
5058        { 
51-             _webDriver . Quit ( ) ; 
59+             try 
60+             { 
61+                 _webDriver . Quit ( ) ; 
62+             } 
63+             catch  ( Exception  ex ) 
64+             { 
65+                 Console . WriteLine ( ex . Message ,  ex ) ; 
66+             } 
67+             finally 
68+             { 
69+                 Helper . KillProcesses ( _driverExe ) ; 
70+             } 
5271        } 
5372    } 
5473} 
0 commit comments