简体   繁体   English

我的Selenium Chrome Headless浏览器是否可以正常工作?

[英]Is my Selenium Chrome Headless browser working as it should?

I am trying to make a connection to Google using Selenium with the headless parameter because I dont want a webbrowser to pop up. 我正在尝试使用带有Selenium的无头参数连接到Google,因为我不希望弹出Web浏览器。 And this is what I get This is what it looks like 这就是我得到的这就是它的样子

public static void Main(string[] args)
        {
            LoadPage();
        }

        private static void LoadPage()
        {
            string path = @"C:\Users\Dev\Documents\";
            ChromeOptions option = new ChromeOptions();

            IWebDriver _driver;
            option.AddArgument("--headless");
            _driver = new ChromeDriver(path, option);
            _driver.Navigate().GoToUrl("http://Google.com");
            Console.WriteLine("Done");
        }

How do I make sure I actually connecto to Google? 如何确定我实际上已连接到Google?

According to google , you have to disable GPU. 根据google ,您必须禁用GPU。 Then you won't see that error. 然后,您将不会看到该错误。 This is only temporarily workaround. 这只是暂时的解决方法。

IWebDriver _driver;
option.AddArgument("--headless");
option.AddArgument("--disable-gpu");

(I don't know the impact of disabling GPU) (我不知道禁用GPU的影响)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM