chrome headless with selenium grid

170 views
Skip to first unread message

Dan Martin

unread,
May 1, 2018, 5:58:05 PM5/1/18
to Selenium Users
I have not been able to get Chrome to run headless when running through a hub. Has anyone solved this? I can pass the chrome headless option directly to a node using the webdriver for chrome, but cannot make it work using webdriver for remote.

Firefox has an environmental variable that I can set, MOZ_HEADLESS, which works like a charm. I have not been able to locate the equivalent in Chrome. 

Prvn

unread,
May 2, 2018, 10:05:36 AM5/2/18
to Selenium Users
Try

            List<String> argumentsList = Arrays.asList("headless", "no-sandbox");

            chromeOptions.setCapability(CapabilityType.PLATFORM_NAME, Platform.LINUX);

            chromeOptions.addArguments(argumentsList);

Jonathan Herbaut

unread,
May 2, 2018, 10:56:45 AM5/2/18
to Selenium Users
I add arguments headless, disable-gpu and disable-infobars to use an headless version of Chrome

public static RemoteWebDriver SetupRemoteChromeDriver(PlatformType platform, string version, bool headless = false)
{
var options = new ChromeOptions();
if (headless)
{
options.AddArgument("headless");
options.AddArgument("disable-gpu");
}
options.AddArguments("disable-infobars");
options.AddAdditionalCapability(CapabilityType.Platform, platform.ToString().ToUpper(), true);
options.AddAdditionalCapability(CapabilityType.Version, version, true);
return RemoteBuilder.SetupRemoteWebDriver(options);

Dan Martin

unread,
May 15, 2018, 4:37:45 PM5/15/18
to seleniu...@googlegroups.com
Thanks. I was aware of the options, but was having a hard time encoding them in Ruby. This helped me get there.



--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/dSxJtR1hOYs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f552aa0c-cd4f-48d9-9832-96395f082cad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Martin



Reply all
Reply to author
Forward
0 new messages