简体   繁体   English

Windows上的无头Chrome和Selenium?

[英]Headless Chrome and Selenium on Windows?

I've seen that headless Chrome came out in some form last month and I've seen that it can be interacted with via Selenium but the articles I've seen mostly mention Linux and MacOS. 我已经看到无头Chrome在上个月以某种形式出现,我已经看到它可以通过Selenium进行交互,但我看到的文章大多提到了Linux和MacOS。 Is this available for windows (7 and /or 10) yet? 这可用于Windows(7和/或10)吗?

The Headless mode for Windows is available in Chrome 60 beta , and the stable version is likely to be also in the 60th version. 适用于Windows的Headless模式适用于Chrome 60 测试版 ,稳定版可能也适用于第60版。

https://www.google.com/chrome/browser/beta.html https://www.google.com/chrome/browser/beta.html

There are no differences in the launch of Selenium Selenium的推出没有差异

是的,我在Windows上使用它但是版本59(测试版)仍然有一个空窗口弹出。

I've been using Chrome in headless mode for months, with Chrome 59 on Windows. 我已经在无头模式下使用Chrome数月,在Windows上使用Chrome 59。

My Karma config (for a custom Chrome headless) is as follows: 我的Karma配置(对于自定义Chrome无头)如下:

browsers: ['Chrome_headless'],
customLaunchers: {
    Chrome_headless: {
        base: 'Chrome',
        flags: ['--headless', '--disable-gpu', '--disable-plugins', '--window-size=0,0', '--window-position=-9999,0']
    }
},

There is no visible window with these commands. 这些命令没有可见窗口。

However, updating to Chrome 60 seems to have killed this config as it no longer works (as of today) 但是,更新到Chrome 60似乎已经杀死了这个配置,因为它不再有效(截至今天)

I am using Chromedriver headless mode with the version 2.33 with the following config for Capybara: 我正在使用Chromedriver无头模式与版本2.33以及Capybara的以下配置:

Capybara.register_driver :chrome_headless do |app|
  args = ["--window-size=1280,1696", "--no-sandbox", "--headless", "--disable-gpu", "--disable-infobars", "--disable-notifications"]  
  Capybara::Selenium::Driver.new(app, {:browser => :chrome, :args => args})
end

It's working right now in chrome 59 with chromedriver 2.31 (just released). 它现在在chrome 59中使用chromedriver 2.31(刚刚发布)。 The only annoying thing is an empty window popping up at the beginning (just a visual effect) which will be removed in chrome 60 (should be about to release) 唯一令人讨厌的事情是在开始时弹出一个空窗口(只是一个视觉效果),它将在chrome 60中删除(应该即将发布)

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

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