im using nodejs version 8.11.3 and npm version 6.9.0 along with chrome version 75.0.3770.90 (the latest). Im trying to use selenium to open a headless chrome. But the issue is that no matter what I try it just doesnt work. Im using Windows 10 version 1903 (Build 18362.175). Ive installed selenium (npm i selenium-webdriver) and correctly configured them in my windows PATH. There has not been any other preperation for selenium. I tried using all sorts of code that I found online from different sources to get the headless mode running. One example that I tried:
let chrome = require('selenium-webdriver/chrome');
let {Builder} = require('selenium-webdriver');
let driver = new Builder()
.forBrowser('chrome')
.setChromeOptions(new chrome.Options().headless())
.build();
which can be found here: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/chrome.html
or this code:
const fs = require('fs');
const webdriver = require('selenium-webdriver');
const chromedriver = require('chromedriver');
const chromeCapabilities = webdriver.Capabilities.chrome();
chromeCapabilities.set('chromeOptions', {args: ['--headless']});
const driver = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(chromeCapabilities)
.build();
// Navigate to google.com, enter a search.
driver.get('https://www.google.com/');
driver.findElement({name: 'q'}).sendKeys('webdriver');
driver.findElement({name: 'btnG'}).click();
driver.wait(webdriver.until.titleIs('webdriver - Google Search'), 1000);
Which can be found here: https://developers.google.com/web/updates/2017/04/headless-chrome#drivers
And Ive also tried using different code snippets from stackoverflow threads that I found. Now I intentionally copy pasted these code snippets, not because I cant write it myself but because I wanted to use code that should 100% work (since its from official sources) to eliminate that the issue might be my own issue. What happens with that code is that it just starts as normal. All of selenium is working fine but its just not running headless. Im also not getting an error in the console.
Now the question is, did I miss something that I should have done? Do I need to install something thats so obvious that nobody mentions it? Is there any way to troubleshoot the issue? Thanks for all replies!