我一直在使用以下Selenium
代码打开新的Firefox
个人资料。
FirefoxProfile profile = new FirefoxProfile(new File("profile file path"));
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(profile);
driver = new FirefoxDriver(firefoxOptions);
driver.get("application Url");
在我更新到Firefox 63
之前,它一直运行良好,现在出现以下错误。
1540496896005 Marionette DEBUG Accepted connection 0 from 127.0.0.1:53310
1540496896006 Marionette TRACE 0 -> [0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox"}}}]
1540496896006 Marionette TRACE 0 <- [1,1,{"error":"unknown command","message":"newSession","stacktrace":"WebDriverError@chrome://marionette/content/error.js:178: ... et@chrome://marionette/content/server.js:245:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:490:9\n"},null]
Oct 25, 2018 2:48:16 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Exception in thread "main" org.openqa.selenium.WebDriverException: newSession
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:05:20.749Z'
System info: host: 'NRIJCTDU8047923', ip: '10.241.10.83', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
0: 0x4bb74f - <no info>
1: 0x4bbea9 - <no info>
2: 0x43ce8d - <no info>
3: 0x44ce14 - <no info>
4: 0x44944a - <no info>
5: 0x4203e1 - <no info>
6: 0x407dc7 - <no info>
7: 0x6d95b9 - <no info>
8: 0x4173a7 - <no info>
9: 0x6d38b3 - <no info>
10: 0x770b59cd - BaseThreadInitThunk
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:83)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse$$Lambda$200.0000000013211B00.apply(Unknown Source)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.W3CHandshakeResponse$$Lambda$202.0000000011F857C0.apply(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:122)
at org.openqa.selenium.remote.ProtocolHandshake$$Lambda$203.0000000012223A00.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:204)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:969)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:137)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:540)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:527)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:513)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:163)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:245)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:475)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:125)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at selenium.utilities.SeleniumUtilities.OpenApplicationWelcomePage(SeleniumUtilities.java:35)
at selenium.mogems.MoGemsMainPondek.main(MoGemsMainPondek.java:14)
我尝试创建新的配置文件,还尝试了以下代码。
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("Selenium2");
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(myprofile);
driver = new FirefoxDriver(firefoxOptions);
答案 0 :(得分:2)
我只需要更新到最新的geckoDriver。
答案 1 :(得分:0)
这可能对其他人有用,因为从更新到最新的gecko驱动程序(我正在运行旧版的硒独立服务器3.6)后,我并没有立即获得成功。
我正在使用facebook / php-webdriver。 在更新到Firefox 63之后,Selenium独立服务器v3.8.1和geckodriver 0.23的组合阻止了该错误的发生。
答案 2 :(得分:0)
我是我现在更新我的Gecko驱动程序可以正常工作。 https://www.seleniumhq.org/download/。