Hello!
When setting userDataDir and navigating to a url I get an error Unable to receive message from renderer in console output. When I try to do anything else, after this message appears, I get OpenQA.Selenium.WebDriverException: disconnected: not connected to DevTools exception.
If userDataDir is not being set it works perfectly fine.
Error in console:

Exception:
OpenQA.Selenium.WebDriverException: disconnected: not connected to DevTools
(failed to check if window was closed: disconnected: not connected to DevTools)
(Session info: chrome=127.0.6533.101)
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.GetScreenshot()
My code:
using var chromeDriver = UndetectedChromeDriver.Create(
headless: true,
driverExecutablePath: await new ChromeDriverInstaller().Auto(),
userDataDir: $@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\Google\Chrome\User Data"
);
Console.WriteLine("Navigating to nowsecure.nl...");
chromeDriver.GoToUrl("https://nowsecure.nl");
Console.WriteLine("Getting screenshot...");
var screenshot = chromeDriver.GetScreenshot();
Even though I set headless: true, it behaves like it's set to false. The window is opening, navigating to the url and closing immediately.
I would appreciate any help.
Hello!
When setting
userDataDirand navigating to a url I get an errorUnable to receive message from rendererin console output. When I try to do anything else, after this message appears, I getOpenQA.Selenium.WebDriverException: disconnected: not connected to DevToolsexception.If
userDataDiris not being set it works perfectly fine.Error in console:

Exception:
My code:
Even though I set
headless: true, it behaves like it's set tofalse. The window is opening, navigating to the url and closing immediately.I would appreciate any help.