Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. Is this available for windows (7 and /or 10) yet?

like image 706
Sulteric Avatar asked May 09 '17 22:05

Sulteric


People also ask

How do I run Chrome headless in Windows?

--headless \ # Runs Chrome in headless mode. --disable-gpu \ # Temporarily needed if running on Windows. https://www.chromestatus.com # URL to open.

How do I run Chrome headless mode in Selenium?

ChromeOptions options = new ChromeOptions() options. addArgument("headless"); ChromeDriver driver = new ChromeDriver(options); In the above code, the browser is instructed to run in the headless mode using the addArgument() method of the ChromeOptions class provided by the Selenium WebDriver.

Does Selenium support headless browser?

Headless testing is simply running your Selenium tests using a headless browser. It operates as your typical browser would, but without a user interface, making it excellent for automated testing.


1 Answers

I've been using Chrome in headless mode for months, with Chrome 59 on Windows.

My Karma config (for a custom Chrome headless) is as follows:

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)

like image 96
danwellman Avatar answered Sep 24 '22 02:09

danwellman