Need help with Chromium-browser

I am having difficulty to install chromium-browser and its throwing error
’ raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
(unknown error: DevToolsActivePort file doesn’t exist)
(The process started from chrome location /nix/store/58gnnsq47bm8zw871chaxm65zrnmnw53-ungoogled-chromium-108.0.5359.95/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)’

1 Like
  1. How are you trying to install it? (.msi, .exe, CLI, etc.)
  2. What operating system are you using?

Try using pkgs.chromium-browser and chromium --no-sandbox

1 Like

I made a working selenium demo a couple months ago:

https://replit.com/@GrimSteel/seleniumtest

replit.nix

{ pkgs }: {
  deps = [
    pkgs.nodejs-18_x
    pkgs.chromedriver
    pkgs.chromium
    pkgs.glib
    pkgs.nss
    pkgs.fontconfig
  ];
  nativeBuildInputs = [
    pkgs.chromedriver
  ];
}

(Chrome driver + dependencies; not sure if chromium is required)

then no-sandbox like @9pfs1 said:

import { Builder, Browser } from 'selenium-webdriver';
import { Options } from "selenium-webdriver/chrome.js";

const chromeOptions = new Options()
  .addArguments("disable-dev-shm-usage", "no-sandbox");

const driver = await new Builder()
  .forBrowser(Browser.CHROME)
  .setChromeOptions(chromeOptions).build();