Closed EArminjon closed 3 years ago
Probable reason for this error - missing configurations while creating the driver object.
You need to add to add a binary attribute, something like this const binary = new firefox.Binary();
and pass the FIREFOX_BIN
path as a parameter to it.
And call Builder() as follows
const driver = new Builder()
.forBrowser('firefox')
.setFirefoxOptions(new firefox.Options().setBinary(binary))
.build();
This should clear your SessionNotCreatedError error
Also, since you're running firefox with '--headless' attribute, you might want to consider adding '--remote-debugging-port=9224' attribute as well.
options.addArguments('--remote-debugging-port=9224');
This will enable remote debugging on a different port, if you're on the same network. As well as, you should set driver's debugging option to trace level.
I can't do const binary = new firefox.Binary() :
TypeError: firefox.Binary is not a constructor
I search a new solution on google but i got a new error :
2020-01-18T18:10:02.201708+00:00 app[web.1]: WebDriverError: invalid argument: can't kill an exited process
2020-01-18T18:10:02.201720+00:00 app[web.1]: at Object.throwDecodedError (/app/node_modules/selenium-webdriver/lib/error.js:550:15)
2020-01-18T18:10:02.201721+00:00 app[web.1]: at parseHttpResponse (/app/node_modules/selenium-webdriver/lib/http.js:563:13)
2020-01-18T18:10:02.201723+00:00 app[web.1]: at Executor.execute (/app/node_modules/selenium-webdriver/lib/http.js:489:26)
2020-01-18T18:10:02.201725+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:97:5) {
2020-01-18T18:10:02.201728+00:00 app[web.1]: name: 'WebDriverError',
2020-01-18T18:10:02.201729+00:00 app[web.1]: remoteStacktrace: ''
2020-01-18T18:10:02.201732+00:00 app[web.1]: }
My option code :
const {Builder} = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');
require('geckodriver');
const screen = {
width: 1920,
height: 1080
};
let options = new firefox.Options();
//Below arguments are critical for Heroku deployment
options.setBinary(process.env.FIREFOX_BIN);
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--no-sandbox");
options.addArguments('--remote-debugging-port=9224');
options.windowSize(screen);
let driver = new Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.build();
It's still working locally but not on Heroku.
My Firefox version : Mozilla Firefox 68.4.1esr 64bits
WebDriverError: invalid argument: can't kill an exited process
This is a popular selenium webdriver error suggesting that a previous session is still running and has not yet been terminated. As a result a new instance is not able to spawn.
Reboot your heroku instance, it should probably resolve the issue now.
I can't do const binary = new firefox.Binary() :
TypeError: firefox.Binary is not a constructor
I search a new solution on google but i got a new error :
2020-01-18T18:10:02.201708+00:00 app[web.1]: WebDriverError: invalid argument: can't kill an exited process 2020-01-18T18:10:02.201720+00:00 app[web.1]: at Object.throwDecodedError (/app/node_modules/selenium-webdriver/lib/error.js:550:15) 2020-01-18T18:10:02.201721+00:00 app[web.1]: at parseHttpResponse (/app/node_modules/selenium-webdriver/lib/http.js:563:13) 2020-01-18T18:10:02.201723+00:00 app[web.1]: at Executor.execute (/app/node_modules/selenium-webdriver/lib/http.js:489:26) 2020-01-18T18:10:02.201725+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:97:5) { 2020-01-18T18:10:02.201728+00:00 app[web.1]: name: 'WebDriverError', 2020-01-18T18:10:02.201729+00:00 app[web.1]: remoteStacktrace: '' 2020-01-18T18:10:02.201732+00:00 app[web.1]: }
My option code :
const {Builder} = require('selenium-webdriver'); const firefox = require('selenium-webdriver/firefox'); require('geckodriver'); const screen = { width: 1920, height: 1080 }; let options = new firefox.Options(); //Below arguments are critical for Heroku deployment options.setBinary(process.env.FIREFOX_BIN); options.addArguments("--headless"); options.addArguments("--disable-gpu"); options.addArguments("--no-sandbox"); options.addArguments('--remote-debugging-port=9224'); options.windowSize(screen); let driver = new Builder() .forBrowser('firefox') .setFirefoxOptions(options) .build();
options.setBinary( )
works just fine.
Reboot your heroku instance, it should probably resolve the issue now.
heroku restart --app my-app-name
Issue still here :'(
Can you share the result from heroku buildpacks -a your-app-name
.
Also if you want real time support you can ping me on discord Ronnie#4190
I got
1. https://github.com/ronnielivingsince1994/heroku-integrated-firefox-geckodriver
2. heroku/nodejs
Forget about that, I saw your dashboard screenshot. Thanks for uploading it. Helped in investigating..
Remove the buildpack and install again from cli
heroku buildpacks:add https://github.com/pyronlaboratory/heroku-integrated-firefox-geckodriver.git
This should probably fix it for you mate
Hello,
I created a nodejs project which use selenium with firefox headless. My project works locally but not on heroku.
My package.json