I started working on Selenium (C#) and, to my surprise, I cannot run even the simplest project from the Selenium Docs. However, my collegues can run it normally out of the box with no problems.
The only way for me to be able to run is to add the --no-sandbox
option to the Chrome option. Firefox (Gekco) driver doesn't have this problem, and my Chrome version and my Chromedriver version match. But I can't do this with every project because we're using a library that don't pass this option and it's beyond my controls.
What are the policy/configuration that I might need to change?
I have tried to find other similar threads on S/O but none of that solve my issues. Most of them can be solved by updating Chrome/ChromeDriver version but mine is at the latest of 100 (also has the same problem with Chrome 99).
Error
It just stays at data:,
and doesn't proceed to any other page as it should.
Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 61538
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
DevTools listening on ws://127.0.0.1:61542/devtools/browser/38c3268c-dd43-4100-bb1a-71aa2af4c1fc
Unhandled exception. OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:61538/session timed out after 60 seconds.
---> System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
--- End of inner exception stack trace ---
Code
using System;
using System.Threading;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
namespace SeleniumDocs.Hello
{
public class HelloSelenium
{
public static void Main()
{
var chromeOptions = new ChromeOptions();
var service = ChromeDriverService.CreateDefaultService(@"C:\WebDriver\bin");
// chromeOptions.AddArgument("--no-sandbox"); // with this it works; without, doesn't
var driver = new ChromeDriver(service, chromeOptions);
driver.Navigate().GoToUrl("https://selenium.dev");
Thread.Sleep(10000);
driver.Quit();
}
}
}
--no-sandbox
attribute: What does the Chromium option--no-sandbox
mean? – Wicket