the http request to the remote web driver server for url selenium c# – Stack Overflow

I am using c# with selenium web driver (4.8.2), Web driver manager (2.16.2) and Chrome Browser (118). and This is my code to initialize the browser to start the test:

new WebDriverManager.DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);

var options = new ChromeOptions();

options.AddArguments("--no-sandbox");   
options.AddUserProfilePreference("profile.default_content_setting_values.images", 2);

options.AddArgument("--remote-debugging-port=0");

options.AddArguments("--headless");

options.AddArguments("--disable-gpu");

options.AddArguments("--window-size=1280,800");

options.AddArguments("--disable-blink-features=AutomationControlled");

options.AddArguments("--disable-extensions");

Statics.Driver = new ChromeDriver(ChromeDriverService.CreateDefaultService(), options, TimeSpan.FromMinutes(3));

Statics.Driver.Manage().Timeouts().PageLoad.Add(TimeSpan.FromMinutes(3));

But sometimes I got the following error:
The HTTP request to the remote WebDriver server for URL localhost:51122/session/6f95462841136a5212e606fe741724fd/element/86BF94BB6EF686852725954F6F12C948_element_6/click timed out after 180 seconds.

Is there any root solution for this error.

Read more here: Source link