java web start ie_WebDriver 调用ie浏览器报错(转)

报错信息如下:

Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:53:56'

System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_23'

Driver info: driver.version: InternetExplorerDriver

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)

at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)

at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:201)

at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:105)

at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:51)

at com.example.tests.test.main(test.java:27)

Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.

Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:53:56'

System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_23'

Driver info: driver.version: InternetExplorerDriver

at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)

... 5 more

Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:35700/status] to be available after 20553 ms

at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)

at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)

... 7 more

Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException

at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)

at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79)

... 8 more

Caused by: java.util.concurrent.TimeoutException

at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)

at java.util.concurrent.FutureTask.get(Unknown Source)

at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)

... 9 more

解决:

You will need InternetExplorer driver executable on your system. So download it from the hinted source (http://code.google.com/p/selenium/downloads/list) unpack it and place somewhere you can find it. In my example, I will assume you will place it to C:\Selenium\iexploredriver.exe

Then you have to set it up in the system. Here is the Java code pasted from my Selenium project:

File file = new File("C:/Selenium/iexploredriver.exe");

System.setProperty("webdriver.ie.driver", file.getAbsolutePath());

WebDriver driver = new InternetExplorerDriver();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值