0

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"]
      }}
      ]

2 Answers 2

0

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:

1
  • Thanks. I removed that part but still get this error: 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.)
    – Anja
    Commented Jul 6, 2023 at 23:39
0

Try to install :

sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils

And install chrome :

sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get -fy install

It should work with : -c "goog:chromeOptions.args=[disable-infobars, headless]"

https://stackoverflow.com/a/47204160

It worked for me inside the docker container an on my machine too.

Not the answer you're looking for? Browse other questions tagged or ask your own question.