There's the bunch of settings I had to pass to chromedriver to make it work in WSL:
ChromeDriverParameterPromiseLocal = "--no-sandbox";
ChromeDriverParameterHeadless = "--headless";
ChromeDriverParameterDisableGPU = "--disable-gpu";
ChromeDriverParameterNoDevShm = "--disable-dev-shm-usage";
ChromeDriverParameterDefaultProfile = "--profile-directory=Default";
ChromeDriverParameterUserDataDir = "--user-data-dir=~/.config/google-chrome";
ChromeDriverParameterVerbose = "--verbose";
ChromeDriverParameterDisregardIP6 = "--whitelisted-ips=";
I have no clue of Python, but that should give you an idea of what you'll need to set.
That's how to set it in C#
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments(new List<string>
{
// https://stackoverflow.com/q/50642308/1132334
PdfConstants.ChromeDriverParameterPromiseLocal,
PdfConstants.ChromeDriverParameterHeadless,
PdfConstants.ChromeDriverParameterDisableGPU,
PdfConstants.ChromeDriverParameterNoDevShm,
PdfConstants.ChromeDriverParameterDefaultProfile,
PdfConstants.ChromeDriverParameterUserDataDir,
PdfConstants.ChromeDriverParameterVerbose,
PdfConstants.ChromeDriverParameterDisregardIP6
});
with relevant SO link,
and then
using var driver = new ChromeDriver(
executableLocation,
chromeOptions
);
The driver is very picky about the version. Both components are semantically versioned, and Chromium update their major version quite frequently. You need to make sure that they match, a 112.x chromedriver wouldn't drive a 114.x chrome, and the messages it throws in this case are useful but only ever shown with the --verbose flag.