zoukankan      html  css  js  c++  java
  • 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.<init>(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:Seleniumiexploredriver.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();

  • 相关阅读:
    介绍一款能取代 Scrapy 的 Python 爬虫框架
    盘点 Django 展示可视化图表的多种方式(建议收藏)
    阿里最强 Python 自动化工具开源了!
    推荐一款小众且好用的 Python 爬虫库
    该死的端口占用!教你用 Shell 脚本一键干掉它!
    字节跳动实习面经分享(已拿offer附攻略)
    这样给小白讲原码、反码、补码,帮她彻底解决困扰了三天的问题
    并查集是一种怎样的数据结构?
    约瑟夫环问题的三种解法,一文搞定
    数据结构:栈详解
  • 原文地址:https://www.cnblogs.com/fatfatdachao/p/3991438.html
Copyright © 2011-2022 走看看