自动测试-selenium启动Firefox失败并报错:无法找到匹配的功能集
package com.selenium.study;import org.openqa.selenium.*;import org.openqa.selenium.WebDriver;import org.openqa.selenium.firefox.*;public class study { public static void main(String[] args) { // TODO Auto-generated method stub //实例化一个对象Firefox WebDriver driver; System.setProperty("webdriver.gecko.driver", "C:\\Program Files\\Mozilla Firefox\\geckodriver.exe"); //获取路径 driver = new FirefoxDriver(); String testurl="http://www.baidu.com"; driver.get(testurl); System.out.println(driver.getTitle()); driver.quit(); }}报错:
1517058193132 geckodriver INFO geckodriver 0.19.1
1517058193147 geckodriver INFO Listening on 127.0.0.1:28726
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'MS-20170227JPSV', ip: '192.168.31.225', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_92'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
0: 0x47e934 -
1: 0x47f0a3 -
2: 0x442511 -
3: 0x4436da -
4: 0x42a890 -
5: 0x406f5e -
6: 0x40cfc9 -
7: 0x6bef19 -
8: 0x420756 -
9: 0x6b96e0 -
10: 0x770059cd - BaseThreadInitThunk
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:120)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:98)
at com.selenium.study.study.main(study.java:13) |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|