0

I'm using this code to create a new instance of Selenium ChromeDriver in C#:

internal static IWebDriver createMyDriver()
{
    var opt = new ChromeOptions();
    var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
        string dir = "--user-data-dir=" + userProfile  + "\\AppData\\Local\\Google\\Chrome\\User Data";
    opt.AddArgument(dir);
    var dri = new ChromeDriver(opt);
    return dri;
}

This code worked fine for years. However, now (on Selenium.WebDriver.ChromeDriver 136.0.7103.92) it freezes.

This is the stack trace:

[Async] System.Net.Http.HttpConnection.InitialFillAsync(bool)
[Async] System.Net.Http.HttpConnection.SendAsyncCore(System.Net.Http.HttpRequestMessage, bool, System.Threading.CancellationToken)
[Async] System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(System.Net.Http.HttpRequestMessage, bool, bool, System.Threading.CancellationToken)
[Async] System.Net.Http.RedirectHandler.SendAsync(System.Net.Http.HttpRequestMessage, bool, System.Threading.CancellationToken)
[Async] System.Net.Http.HttpClient.SendAsync.__Core|83_0(System.Net.Http.HttpRequestMessage, System.Net.Http.HttpCompletionOption, System.Threading.CancellationTokenSource, bool, System.Threading.CancellationTokenSource, System.Threading.CancellationToken)
[Async] OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(OpenQA.Selenium.Remote.HttpCommandExecutor.HttpRequestInfo)
[Async] OpenQA.Selenium.Remote.HttpCommandExecutor.ExecuteAsync(OpenQA.Selenium.Command)
[Async] OpenQA.Selenium.Remote.DriverServiceCommandExecutor.ExecuteAsync(OpenQA.Selenium.Command)
[Async] OpenQA.Selenium.WebDriver.ExecuteAsync(string, System.Collections.Generic.Dictionary<string, object>)
[Async] System.Threading.Tasks.Task.Run
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
[Waiting on Async Operation, double-click or press enter to view Async Call Stacks]
OpenQA.Selenium.WebDriver.Execute(string, System.Collections.Generic.Dictionary<string, object>)
OpenQA.Selenium.WebDriver.StartSession(OpenQA.Selenium.ICapabilities)
OpenQA.Selenium.WebDriver.WebDriver(OpenQA.Selenium.ICommandExecutor, OpenQA.Selenium.ICapabilities)
OpenQA.Selenium.Chrome.ChromeDriver.ChromeDriver(OpenQA.Selenium.Chrome.ChromeOptions)
MyApp.Program.createMyDriver()

It freezes on the last line line in WebDriver.Execute:

// source code from Selenium 
protected internal virtual Response Execute(string driverCommandToExecute, Dictionary<string, object>? parameters)
{
    string driverCommandToExecute2 = driverCommandToExecute;
    Dictionary<string, object> parameters2 = parameters;
    return Task.Run(() => ExecuteAsync(driverCommandToExecute2, parameters2)).GetAwaiter().GetResult();
}

The freeze only happens when providing the --user-data-dir parameter.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.