面对Windows 10上IE 11的问题,浏览器已启动,但未输入URL

时间:2018-01-09 13:04:26

标签: selenium selenium-webdriver selenium-iedriver

Selenium代码:

Started InternetExplorerDriver server (64-bit)
3.8.0.0
Listening on port 25160
Only local connections are allowed
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: session null does not exist (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'TS-39', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'

错误:

class LoggingService [Inject] (protected val logger: Logger)

class LoggingService @Inject (protected val logger: Logger)

1 个答案:

答案 0 :(得分:1)

错误说明了一切:

org.openqa.selenium.remote.SessionNotFoundException: session null does not exist

原因

您看到 SessionNotFoundException 的主要原因是由于以下原因:

  • 您正在使用版本 3.8.0.0 InternetExplorerDriver ,这从以下日志中可以看出并且已正确启动。

    Started InternetExplorerDriver server (64-bit)
    3.8.0.0
    Listening on port 25160
    Only local connections are allowed
    
  • 但您的 Selenium 版本 2.53.1 ,从以下日志中可以看出这一点:

    Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
    
  • 此外,您的 JDK 版本的版本比版本 1.8.0_91 更旧,这从以下日志中可以看出:

    System info: host: 'TS-39', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
    

解决方案

简单的解决方案是:

  • JDK 版本更新为当前级别 JDK(Java SE 9.0.1)
  • Selenium-Java客户端版本更新为当前级别 v3.8.1
  • InternetExplorerDriver 版本更新为当前级别 v3.8.0.0
  • 执行Test