I used Selenium in my Chrome browser and recorded a series of steps. It works great in the browser. I want to get it to run automatically once per day, so I thought I'd try to get it to run from the command line so that I can put it in a crontab.
I did some googling and installed selenium-side-runner. I am trying to run the file from my terminal using "selenium-side-runner script.side".
This is the error I'm getting:
WebDriverError: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
What can I try to do to fix this error? Or is there another way I can get this to run daily using the chrome extension and not using the command line?
After getting the error, I did more searching and tried adding these options to the .side file, but it didn't fix the issue:
"environments": [
{
"id": "chrome",
"capabilities": [
{
"browserName": "chrome",
"chromeOptions": {
"binary": "/usr/bin/chromium-browser"
}
},{
"browserName": "chrome",
"goog:chromeOptions": {
"args": ["--no-sandbox","--headless"]
}}
]
You don't need the
--no-sandbox
argument unless you are executing as a root user. So remove the argument and execute your program.References
You can find a couple of relevant detailed discussions in:
--no-sandbox
to run Selenium Chromedriver even with admin privilege