我正在尝试使用 Selenium 进行网站自动化。
在无头模式下,一切都运行良好,但我需要看看那里发生了什么。
static void Main(string[] args) {
var path = @"C:\qq\ChromeDriver";
var options = new ChromeOptions();
//options.AddArgument("--headless"); //with headless no issues
options.AddArgument("--disable-dev-shm-usage"); // overcome limited resource problems
options.AddArgument("start-maximized"); // open Browser in maximized mode
options.AddArgument("disable-infobars"); // disabling infobars
options.AddArgument("--disable-extensions"); // disabling extensions
options.AddArgument("--disable-gpu"); // applicable to windows os only
options.AddArgument("--no-sandbox"); // Bypass OS security model
options.AddArgument("--incognito");
IWebDriver driver = new ChromeDriver(path, options); //execution stucks here
driver.Navigate().GoToUrl("https://google.com");
}
Run Code Online (Sandbox Code Playgroud)
我的 Chrome 版本是
Google Chrome 87.0.4280.88 (Official Build) (32-bit) (cohort: Stable) …Run Code Online (Sandbox Code Playgroud)