I am trying to run headless chrome with arguments with pass with chromeOptions, I have the following config as wct.conf.json but it is not working.
{
"verbose": false,
"testTimeout": 30000,
"expanded": true,
"persistent": false,
"browserOptions": {
"browserName" : "chrome",
"chromeOptions" : {
"args" : ["--headless"]
}
},
"plugins": {
"local": {
"browsers": [
"chrome"
]
}
}
}
P.S Also, it install chromedriver 2.27 which needs to be changed to latest chromedriver 2.29
Looks like there's an open PR to update chromedriver in selenium-standalone: https://github.com/vvo/selenium-standalone/pull/285
I have similar frustration trying to run Web Component Tester v6.0.0 for local headless browser testing with selenium. This doesn't seem to be usable with either the --headless flag or running X Virtual Frame Buffer in the background.
Some sample output:
Capabilities [{message=unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.9.27-moby x86_64), platform=ANY}]
Session ID: ebefab875035f0e02e02da14458886d9
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:103)
at com.sun.proxy.$Proxy4.get(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.get(EventFiringWebDriver.java:162)
at org.openqa.selenium.remote.server.handler.ChangeUrl.call(ChangeUrl.java:40)
at org.openqa.selenium.remote.server.handler.ChangeUrl.call(ChangeUrl.java:25)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
It would be nice if there was some better documentation/working examples of using browserOptions and chromeOptions for configuring the chrome browser.
On a related note, is it possible to determine/debug which CLI options are _actually_ passed to the google-chrome command via the chromedriver?
The problem is actually here:
https://github.com/Polymer/web-component-tester/blob/master/runner/steps.ts#L148
lodash's defaultsDeep method is overriding values that are arrays instead of concatenating them. This is possibly fixed by using mergeWith (plus a callback to handle arrays), but it's not available in wct's packaged version of lodash... Upon updating, lodash@latest is then missing pairs method, which is used by this application. So, damned if you do, damned if you don't.
I will submit a PR tomorrow with my workaround, which uses deepmerge package instead. This correctly concats the arrays.
One last note, if you're trying to pass headless, all of this is dependent on https://github.com/vvo/selenium-standalone/pull/285, which needs to require v2.30.
Lastly, for any poor souls like myself trying to get something like this working, do please be sure you have Chrome v59 installed.
This open PR (https://github.com/vvo/selenium-standalone/pull/285) has long been merged. I see this PR referred in multiple related issues. Not sure what is still pending.
The --headless problem is solved (I believe). But there is also a problem with lodash implementation. See my last comment. I wasn't able to submit a new PR (at the time) because the ts wasn't compiling.
This is fixed with 24fab4d6b4c7395cbf4f40b2fdf365fb724eb9e0 And instead of chromeOptions it is browserOptions
It is done like
{
"plugins": {
"local": {
"browsers": [
"chrome"
],
"browserOptions": {
"chrome": [
"window-size=1920,1080",
"headless",
"disable-gpu"
}
}
}
}
@desaib @usergenic This issue is fixed
Most helpful comment
I have similar frustration trying to run Web Component Tester v6.0.0 for local headless browser testing with selenium. This doesn't seem to be usable with either the
--headlessflag or running X Virtual Frame Buffer in the background.System Info
Some sample output:
It would be nice if there was some better documentation/working examples of using
browserOptionsandchromeOptionsfor configuring the chrome browser.On a related note, is it possible to determine/debug which CLI options are _actually_ passed to the
google-chromecommand via the chromedriver?