问题
I am trying to load Firefox to test my web application using selenium. I am getting SessionNotCreatedError: Unable to create new service: GeckoDriverService
error when I specify firefox in the capabilities
. Here is how it looks like:
var config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
framework: 'jasmine2',
capabilities: {
browserName: 'firefox',
version: '57.0',
'screenResolution': '1920x1440'
},
specs: [
'*.spec.js'
],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 300000,
print: function() {}
},
params: {
defaultTimeout: 15000
}
};
Here are details of my environment:
OS: Ubuntu 16.04 LTS 64bit
Firefox: Quantum 57 64 bit
Selenium: 3.7.1
webdriver-manager: 12.0.6
gecko driver: 0.19.1
Protractor: 5.2.0
When I ran my protractor End-to-End test cases it throws this error:
[13:14:58] E/launcher - SessionNotCreatedError: Unable to create new service: GeckoDriverService
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-38-generic', java.version: '1.8.0_151'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/home/dev/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/home/dev/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/home/dev/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
at Function.createSession (/home/dev/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/home/dev/node_modules/selenium-webdriver/firefox/index.js:521:41)
at createDriver (/home/dev/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/home/dev/node_modules/selenium-webdriver/index.js:632:16)
at Local.getNewDriver (/home/dev/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
at Runner.createBrowser (/home/dev/node_modules/protractor/built/runner.js:195:43)
at q.then.then (/home/dev/node_modules/protractor/built/runner.js:339:29)
at _fulfilled (/home/dev/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/home/dev/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/home/dev/node_modules/protractor/node_modules/q/q.js:796:13)
[13:14:58] E/launcher - Process exited with error code 199
I tried using updated versions of selenium and gecko driver but that did not help either.
I added marionette: true
but still getting the same error. I also tried "javascriptEnabled": true, "acceptSslCerts": true
but with no success.
回答1:
It work for me when using geckodriver@1.10.0 and Firefox 57.0 (64 bits).
来源:https://stackoverflow.com/questions/47401348/firefox-57-does-not-load-geckoservice-in-selenium-during-end-to-end-testing