Chromium Driver With Selenium C# on Raspberry Pi 4 (Raspbian OS) Failing With Version Issues

Viewed 28

What I have

  1. I've a Raspberry Pi 4 running Raspbian OS (Flavor of Linux).
  2. It has a "Chromium" browser pre-installed which says is on latest version.

What I want

  1. I need to do some scraping works on it
  2. I prefer to use .NET 6 to do the coding. It works flawlessly on my Windows 11 PC
  3. I want to make it work on Raspberry Pi
  4. I've installed .NET runtimes and other pre-requisites on the Pi and can run any .NET programs I'm doing on my PC.

What's The Issue

  1. I checked what version of Chromium browser I've currently at this moment and saw it's

92.0.4515.98.

enter image description here

  1. The I installed latest Chromium driver using this Linux command:

sudo apt install chromium-chromedriver

enter image description here

  1. Everything looks to be good. But now when I'm running my program on Linux, I'm getting the following error. Is it related to version issue? If so how can I download a specific version of Chrome Driver in Linux that matches my Chromium version?

enter image description here

This is my Chrome initialization code where I get a handle of Chrome and then scrape with it

public ChromeDriver StartChromium(bool openBrowser)
{
  var options = new ChromeOptions
  {
    AcceptInsecureCertificates = true,
  };
  if (!openBrowser)
  {
    options.AddArguments("headless");
  }
  var service = ChromeDriverService.CreateDefaultService();
  service.SuppressInitialDiagnosticInformation = true;
  service.HideCommandPromptWindow = true;
  options.AddArgument("--no-sandbox");
  return new ChromeDriver(service, options);
}
0 Answers
Related