new InternetExplorerDriver();
但是我可以看到如下异常:
OpenQA.Selenium.DriverServiceNotFoundException was unhandled by user code HResult=-2146233088 Message=The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://code.google.com/p/selenium/downloads/list. Source=WebDriver StackTrace: at OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String executableName, Uri downloadUrl) at OpenQA.Selenium.IE.InternetExplorerDriverService.CreateDefaultService() at OpenQA.Selenium.IE.InternetExplorerDriver..ctor(InternetExplorerOptions options) at OpenQA.Selenium.IE.InternetExplorerDriver..ctor() at Accelrys.CommonTestFramework.WebActions.WebActionLibrary.CreateSeleniumDriver()
如异常所示,您需要根据您拥有的IE下载32位或64位的IEDriverServer,并确保它在我们的路径中可用。就是说,您在命令行上键入IEDriverServer.exe时,应该可以解决该问题。试试看