我想尝试无头镀铬,但我遇到了这个问题,我无法在无头模式下启动驱动程序.我正在关注谷歌文档.我错过了什么吗?该代码执行陷在var browser = new ChromeDriver();线路
这是我的代码:
var chromeOptions = new ChromeOptions
{
BinaryLocation = @"C:\Users\2-as Aukstas\Documents\Visual Studio 2017\Projects\ChromeTest\ChromeTest\bin\Debug\chromedriver.exe",
DebuggerAddress = "localhost:9222"
};
chromeOptions.AddArguments(new List<string>() {"headless", "disable-gpu" });
var browser = new ChromeDriver(chromeOptions);
browser.Navigate().GoToUrl("https://stackoverflow.com/");
Console.WriteLine(browser.FindElement(By.CssSelector("#h-top-questions")).Text);
Run Code Online (Sandbox Code Playgroud)