如何设置可执行IE 11驱动程序的路径

问题描述:

我是Selenium的新手我试图将HP ALM与Selenium集成。我试图在IE 11中启动HP ALM。我没有获得适用于IE11的正确webdrivers。 以下是错误:如何设置可执行IE 11驱动程序的路径

FAILED CONFIGURATION: @BeforeClass Init java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver . The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:197) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109) at org.openqa.selenium.ie.InternetExplorerDriverService.access$0(InternetExplorerDriverService.java:1) at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.findDefaultExecutable(InternetExplorerDriverService.java:167) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296) at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:251) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:172) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:146) at database.Test1.Init(Test1.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104) at org.testng.TestRunner.privateRun(TestRunner.java:773) at org.testng.TestRunner.run(TestRunner.java:623) at org.testng.SuiteRunner.runTest(SuiteRunner.java:357) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310) at org.testng.SuiteRunner.run(SuiteRunner.java:259) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185) at org.testng.TestNG.runSuitesLocally(TestNG.java:1110) at org.testng.TestNG.run(TestNG.java:1018) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

浏览到webforums在错误发出后。我收到上述错误。专家能帮我解决这个问题吗?另外我会要求使用Selenium在QC中运行测试集的指导原则。

错误消息告诉你(几乎)到底该怎么做:

The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver . The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html

下载最新的IE驱动程序服务器(64位或32位 - 这很重要)从http://selenium-release.storage.googleapis.com/index.html?path=2.49/,它运行根据指示得到,然后简单地做:

System.setProperty("webdriver.ie.driver", "<your download location>"); 

@BeforeClass创建您的webdriver引用之前。