node-chrome with --headless rather than XVFB
Run node-chrome with --headless rather than XVFB, to reduce resource usage.
Users don't browse in xvfb, what's your point?
no, users use the physical browser. Xvfb allows the rendering of said physical browsers.
Are you suggesting that chrome --headless behaves differently from chrome under xvfb?
On 12 Apr 2017 02:29, "Dj" [email protected] wrote:
no, users use the physical browser. Xvfb allows the rendering of said physical browsers.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/docker-selenium/issues/429#issuecomment-293446550, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQTMWyJFMfal-UsVak1INjMBFNCeS7ks5rvCkKgaJpZM4MusZ3 .
PhantomJS' solo maintainer is leaving because of headless chrome. Can we reopen this discussion? (source: https://groups.google.com/forum/#!topic/phantomjs/9aI5d-LDuNE)
i guess i'm not familiar with chrome's headless mode.. tell me more, @graingert
@ddavison you run chrome --headless and it manages its own internal framebuffer, rather than needing X11
It should massively simplify the default node-chrome.
Also it's got a VNC like protocol over the chrome debug socket, so you wouldn't need node-chrome-debug either
I think the biggest benefit that users find with the debug, is that you can VNC into it. You're saying that this could be eliminated? If that's the case, ok then. sign me up - apologies for the abrupt closing. An issue file with a very small description is dangerous as it leaves everything up to speculation :)
I wasn't familiar with chrome --headless (hence why i asked you to elaborate)
If this is possible, then yes.. we'll go this route. I'll keep this issue open and i'll mark as investigating.
I think most automated testing will use chrome headless going forwards, and using docker for automated testing is a perfect fit, so this just seems like an obvious thing, in fact, iv been asking about it for the last few months and even tried to roll my own but chrome --headless was buggy. Big +1 from me on this as PhantomJS 2.5 release isn't even available and maybe we won't see it now that the maintainer has stepped down.
The main reason is quite simple.... Chrome uses a lot of memory and cpu and that should be lower without Xvfb and real rendering.
So, I just put in some time into this. XVFB will still be required for almost all projects, sadly (unless someone finds a workaround)
In general it wasn't too rough to get running, but I get thrown the following when I try to use it for tests that have keyCode interactions (aka, any sendkeys stuff):
unknown error: an X display is required for keycode conversions, consider using Xvfb
(Session info: content shell=)
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.9.4-moby x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 26 milliseconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: '1d5acd9906ce', ip: '172.17.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.4-moby', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
EDIT: Throwing XVFB in and using that to run the SE process (like normal), it all works properly, I'm just not sure that we're gaining much if we do that.
I haven't poked around with this repo in ages. Do y'all have a standardish way of measuring performance?
I guess the XVFB thing is a chromedriver requirement, so I opened a ticket here: https://bugs.chromium.org/p/chromedriver/issues/detail?id=1772
If you wanna reproduce / help out with finding a fix, you can find steps to make an easy one-off container that runs selenium locally (without a hub/node configuration) in that issue. It's easy enough to convert those steps into the docker-selenium containers, but the send key stuff still exists.
Indeed, I managed even to set the Chrome browser window size but once I removed Xvfb from docker-selenium I was also bitten by @SpencerMalone error:
Failed: unknown error: an X display is required for keycode conversions, consider using Xvfb
(Session info: headless chrome=58.0.3029.81)
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-72-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 22 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'ccd8e5f77172', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-72-generic', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5), userDataDir=/tmp/.org.chromium.Chromium.u1tWQG}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.81, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: a7bc6bb38644f13e7a9c9b2c33fbcd61
I like the idea but please do not remove the current node-chrome and node-chrome-debug images when creating the headless images. I still like the idea of using real browsers inside containers.
I think there won't be need to remove them, or even create a new image, you just need to pass some specific capabilities to Chrome, I think @elgalu showed them to me yesterday, can you share them?
Correct, this works already:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['headless', 'window-size=1920x1080']
}
}
Using the selenium node base image, I've found the following configuration works best:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['headless','no-sandbox','disable-gpu','window-size=1920x1080']
}
}
Keeping the sandbox enabled caused an exception when selenium tried to start chrome.
I put together an example app that extends the selenium node base image, installs latest snapshot of chromium (with headless bugfixes), and installs a recent build of chromedriver which allows chrome > 59. Unfortunately, I also discovered xvfb is required for sendKeys to work.
Would be good to have a separate image node-chrome-headless to save space on xvfb and deps
On 22 Apr 2017 16:10, "Derek Kastner" [email protected] wrote:
Using the selenium node base image, I've found the following configuration works best:
capabilities: { browserName: 'chrome', chromeOptions: { args: ['headless','no-sandbox','disable-gpu','window-size=1920x1080'] } }
Keeping the sandbox enabled caused an exception when selenium tried to start chrome.
I put together an example app https://github.com/dkastner/headless-chromium-selenium that extends the selenium node base image, installs latest snapshot of chromium (with headless bugfixes), and installs a recent build of chromedriver which allows chrome > 59. Unfortunately, I also discovered xvfb is required for sendKeys to work.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/docker-selenium/issues/429#issuecomment-296379624, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQTF5zuwN0IBMsL9Bq1m1B9eulvid5ks5ryhhOgaJpZM4MusZ3 .
Awesome! This sounds like it requires half the resources of selenium/standalone-chrome (e.g. disk, RAM)
yes, which would be super useful as we're hitting the resource limits on our aws instances using the standard selenium images. Headless should help there.
@graingert, is it possible already to run Chrome headless without xvfb?
Yes
On 28 May 2017 18:31, "Diego Molina" [email protected] wrote:
@graingert https://github.com/graingert, is it possible already to run Chrome headless without xvfb?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/docker-selenium/issues/429#issuecomment-304528556, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQTGeJl_QBzx8dASjI8P2XPBjTHTWYks5r-a-CgaJpZM4MusZ3 .