i've been trying for hours launching a selenium web browser and now it's done, i can't put it in headless mode ( want it to perform tasks in background ). My electron app is a simple quick start with a button launching a Selenium webdriver. Here's my code :
document.getElementById("test").onclick = function () {
require('chromedriver');
var webdriver = require('selenium-webdriver');
var chromeCapabilities = webdriver.Capabilities.chrome();
//setting chrome options
var chromeOptions = {
'args': ['--headless']
};
chromeCapabilities.set('chromeOptions', chromeOptions);
var driver = new webdriver.Builder().withCapabilities(chromeCapabilities).build();
driver.get('http://www.google.com/');
};
What it makes : When you press the test button, selenium browser is launched and appears in my screen instead of being headless or in background :( It seems like it doens't take in consideration the args of the chromeOption variable. I tried to put many different flags with many different syntaxes but noone of them worked. Does anyone have a solution please ?