Selenium调用IE出错SessionNotCreatedException
从头到尾看了几遍官方文档,也把IEDriverServer.exe加入了PATH,也试过
File file = new File("C:\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
这样加载,代码就一句:
public class Test {
public static void main(String[] args) {
WebDriver driver = new InternetExplorerDriver();
}
}
但是报错
Listening on port 30697
Only local connections are allowed
十月 20, 2016 3:33:31 下午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
十月 20, 2016 3:33:32 下午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Falling back to original OSS JSON Wire Protocol.
十月 20, 2016 3:33:32 下午 org.openqa.selenium.remote.ProtocolHandshake createSession
信息: Falling back to straight W3C remote end connection
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'WIN-3DLUDLJN43H', ip: '10.0.2.15', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:144)
at Fuck.main(Fuck.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Process finished with exit code 1
试了很多windows版本和IE版本,selenium3.0和3.0.1都试了,java8环境64位,快疯了跪求大神
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
谢邀。
java的我没玩过,我都是玩python的。但是一般出现问题都是版本匹配上的问题。你可以试试其他浏览器,比如 firefox
传送门:http://www.cnblogs.com/pureso...
抱歉,java我不会用!
你没配置文件
看一下 你的host
添加后好使不
现在解决了吗?我也遇到相同的问题了,求分享,谢谢!