无法使用Internet Explorer驱动程序运行Selenium WebDriver测试 [英] Unable to run Selenium WebDriver tests with Internet Explorer Driver
问题描述
在使用Java运行我的selenium测试期间,我在控制台选项卡中遇到如下错误。
I encountered an error like below in the console tab during run my selenium tests using Java.
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see http://code.google.com/p/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:177)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105)
at org.openqa.selenium.ie.InternetExplorerDriverService.access$1(InternetExplorerDriverService.java:1)
at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.build(InternetExplorerDriverService.java:230)
at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:251)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:146)
at superadminmodule.LoginInPage.main(LoginInPage.java:11)
推荐答案
您需要设置 InternetExpl您的电脑上的orerDriver 。从此地点下载并解压缩IEDriverServer。如你所愿拉链。放置在你的电脑路径。查看更多细节< a href =https://code.google.com/p/selenium/wiki/InternetExplorerDriver =nofollow>此处。
You need to setup InternetExplorerDriver on your pc.Download from this place and unzip IEDriverServer.zip as you like.Place is in your pc PATH.See more detail from here.
如果你使用selenium web驱动程序和JUnit或其他一些测试框架,你需要在你的代码中设置InternetExplorerDriver路径。参见我的JUnit示例设置;
If you use selenium web driver with JUnit or some other testing framework, you need to setup InternetExplorerDriver path into your code.See my JUnit sample setup;
@Before
public void setUp() throws Exception {
File file = new File("C:\\IEDriverServer\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
这博客有一些selenium junit教程。你也可以搜索很多使用google.com的教程:D
This blog has some selenium junit tutorials.You can also search many tutorials using google.com :D
这篇关于无法使用Internet Explorer驱动程序运行Selenium WebDriver测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!