Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-chrome with --headless rather than XVFB #429

Closed
graingert opened this issue Mar 30, 2017 · 73 comments · Fixed by #796
Closed

node-chrome with --headless rather than XVFB #429

graingert opened this issue Mar 30, 2017 · 73 comments · Fixed by #796

Comments

@graingert
Copy link
Contributor

Run node-chrome with --headless rather than XVFB, to reduce resource usage.

@graingert
Copy link
Contributor Author

graingert commented Apr 11, 2017

Users don't browse in xvfb, what's your point?

@ddavison
Copy link
Member

no, users use the physical browser. Xvfb allows the rendering of said physical browsers.

@graingert
Copy link
Contributor Author

graingert commented Apr 12, 2017 via email

@SpencerMalone
Copy link

PhantomJS' solo maintainer is leaving because of headless chrome. Can we reopen this discussion? (source: https://groups.google.com/forum/#!topic/phantomjs/9aI5d-LDuNE)

@ddavison
Copy link
Member

i guess i'm not familiar with chrome's headless mode.. tell me more, @graingert

@ddavison ddavison reopened this Apr 13, 2017
@graingert
Copy link
Contributor Author

graingert commented Apr 13, 2017

@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

@ddavison
Copy link
Member

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.

@madhavajay
Copy link

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.

@SpencerMalone
Copy link

SpencerMalone commented Apr 19, 2017

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?

@SpencerMalone
Copy link

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.

@elgalu
Copy link
Member

elgalu commented Apr 21, 2017

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

@testphreak
Copy link
Contributor

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.

@diemol
Copy link
Member

diemol commented Apr 22, 2017

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?

@elgalu
Copy link
Member

elgalu commented Apr 22, 2017

Correct, this works already:

capabilities: {
    browserName: 'chrome',
    chromeOptions: {
        args: ['headless', 'window-size=1920x1080']
    }
}

@erithmetic
Copy link

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.

@graingert
Copy link
Contributor Author

graingert commented Apr 22, 2017 via email

@alippai
Copy link

alippai commented May 3, 2017

Awesome! This sounds like it requires half the resources of selenium/standalone-chrome (e.g. disk, RAM)

@ghost
Copy link

ghost commented May 24, 2017

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.

@diemol
Copy link
Member

diemol commented May 28, 2017

@graingert, is it possible already to run Chrome headless without xvfb?

@graingert
Copy link
Contributor Author

graingert commented May 28, 2017 via email

@diemol
Copy link
Member

diemol commented May 28, 2017

@graingert I was asking because if this #429 (comment)
Do you have an example of an image running Chrome headless without xvfb?

@electrumguy
Copy link

@diemol @graingert

I would also like to know this.

@SpencerMalone
Copy link

SpencerMalone commented May 30, 2017 via email

@electrumguy
Copy link

electrumguy commented May 30, 2017

I have found a workaround. It is simply to not use send key and instead use Javascript. Here is an example:

driver = webdriver.Chrome()
driver.find_elements_by_id('solveme').send_keys(Solution)

becomes:

driver = webdriver.Chrome()
Command = "document.getElementById('solveme').value='"+ Solution +"';"
driver.execute_script(Command)

There are multiple selectors for javascript you can use including name, id, class, etc. The above example is with python but it should work with all languages that allow javascript executions using selenium. This is an extremely frustrating issue as the majority of my tests required inputting text into some field. As a temporary workaround, I would suggest using this.

@stguitar
Copy link

stguitar commented Aug 3, 2017

I was also having this issue and can confirm simply updating chromedriver to 2.31 removed the need to use Xvfb

@cbrevik
Copy link

cbrevik commented Aug 4, 2017

Is people getting --headless to work with this library? Keep getting unknown error: Chrome failed to start: exited normally as noted in #520

@guillaumevincent
Copy link

guillaumevincent commented Aug 4, 2017

@cbrevik don't know if it's the solution but on centos 7 container I added liberation-mono-fonts package to avoid this error

@cbrevik
Copy link

cbrevik commented Aug 4, 2017

Thanks for the suggestion @guillaumevincent! Ran fc-list on the container, and it seems like Liberation Mono is already installed.

@ttretau
Copy link

ttretau commented Aug 10, 2017

I updated image to Chromedriver 2.31 and received errors like @cbrevik, WebDriverError: unknown error: Chrome failed to start: exited abnormally. I think from chromedriver logs RESPONSE InitSession unknown error: Chrome failed to start: exited abnormally.
I used args '--headless', '--disable-gpu', '--window-size=800,600' via protractor.

@Nighthawk22
Copy link

I get the following exception if i run chrome headless

13:22:32.631 INFO - Executing: [new session: Capabilities [{rotatable=true, locationContextEnabled=true, loggingPrefs=org.openqa.selenium.logging.LoggingPreferences@3631f3e0, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[--window-size=1280,800, --disable-gpu, --headless]}, handlesAlerts=true, requestOrigins={name=webdriverio, version=4.6.2, url=http://webdriver.io}}]])
13:22:32.650 INFO - Creating a new session for Capabilities [{rotatable=true, locationContextEnabled=true, loggingPrefs=org.openqa.selenium.logging.LoggingPreferences@3631f3e0, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[--window-size=1280,800, --disable-gpu, --headless]}, handlesAlerts=true, requestOrigins={name=webdriverio, version=4.6.2, url=http://webdriver.io}}]
Starting ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57) on port 13834
Only local connections are allowed.
13:23:32.925 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'chrome-4040051761-dgtxj', ip: '192.168.249.212', os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-30-generic', java.version: '1.8.0_131'
Driver info: driver.version: unknown
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
	at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
	at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
	at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131)
	at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
	at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36)
	at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
	at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:190)
	at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222)
	at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)
	at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:543)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
	at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
	at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
	at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
	at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.seleniumhq.jetty9.server.Server.handle(Server.java:564)
	at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:320)
	at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
	at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:112)
	at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
	at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
	at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'chrome-4040051761-dgtxj', ip: '192.168.249.212', os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-30-generic', java.version: '1.8.0_131'
Driver info: driver.version: unknown
	at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:110)
	at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:96)
	at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
	at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
	at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209)
	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)
	... 1 more
Caused by: java.lang.reflect.InvocationTargetException
	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.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:102)
	... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally
  (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.10.0-30-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.07 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'chrome-4040051761-dgtxj', ip: '192.168.249.212', os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-30-generic', java.version: '1.8.0_131'
Driver info: driver.version: ChromeDriver
	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:215)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
	at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:184)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:148)
	... 14 more
13:23:32.934 WARN - Exception: unknown error: Chrome failed to start: exited normally
  (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.10.0-30-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.07 seconds

kaitoy added a commit to kaitoy/webdriverio-chrome that referenced this issue Aug 30, 2017
browser.serValue() causes the following error:
Failed: unknown error: an X display is required for keycode conversions,
consider using Xvfb

This is a chromedriver's bug that is fixed in version 2.31.
This commit is a workaround until the 2.31 will be released for Alpine
Linux.

ref. SeleniumHQ/docker-selenium#429
@uday-rayala
Copy link

uday-rayala commented Sep 14, 2017

Even I am getting the above error. Does anyone know how to avoid this error?

Following are chrome and chromedriver versions:

seluser@b5289d951007:/$ chromedriver --version
ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8)

seluser@b5289d951007:/$ ./opt/google/chrome/chrome --version
Google Chrome 61.0.3163.79 unknown

I am using 3.5.3 version of https://hub.docker.com/r/selenium/standalone-chrome-debug/tags/

@csvan
Copy link

csvan commented Sep 26, 2017

+1

@diemol
Copy link
Member

diemol commented Nov 21, 2017

Hi,

After reading all the thread again it looks like this should work already, right? Has someone achieved it and wants to send a PR?

@diemol
Copy link
Member

diemol commented Dec 4, 2017

Does anyone know if this is the current status for headless?
https://bugs.chromium.org/p/chromium/issues/detail?id=775911

I checked around and I didn't find any more updates. If this stays like that, it wouldn't make so much sense to have headless as default.

@lmtierney
Copy link
Member

I believe it is going to stay that way, at least until https://bugs.chromium.org/p/chromium/issues/detail?id=617931 has some movement

@tnguyen14
Copy link
Contributor

Looks like 617931 is fixed, but 775911 is marked as "WontFix"

@graingert
Copy link
Contributor Author

graingert commented Feb 15, 2018 via email

@tnguyen14
Copy link
Contributor

I was referring to these 2 previous comments:

I believe it is going to stay that way, at least until https://bugs.chromium.org/p/chromium/issues/detail?id=617931 has some movement

and

Does anyone know if this is the current status for headless?
https://bugs.chromium.org/p/chromium/issues/detail?id=775911

diemol added a commit that referenced this issue Oct 3, 2018
wants to run Chrome and Firefox in headless mode and thinks that Xvfb
uses too many resources. Fixes #429 and fixes #567.
@diemol
Copy link
Member

diemol commented Oct 3, 2018

Hi all,

We just made a change in the images and introduces the env var START_XVFB, you can set it to false(or anything different to true when starting the container, and then Xvfb won't be started.

docker network create grid
docker run -d -p 4444:4444 --net grid --name selenium-hub selenium/hub
docker run -d --net grid -e HUB_HOST=selenium-hub -e START_XVFB=false -v /dev/shm:/dev/shm selenium/node-chrome
docker run -d --net grid -e HUB_HOST=selenium-hub -e START_XVFB=false -v /dev/shm:/dev/shm selenium/node-firefox

If you do that, and check the running processes in the container, you'll see:

seluser@6c5028fb1dad:~$ ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
seluser      1  0.2  0.1  58660 18484 ?        Ss   20:30   0:00 /usr/bin/python /usr/bin/supervisord --configuration /etc/supervisord.conf
seluser     13  0.0  0.0  20988  3364 ?        S    20:30   0:00 /bin/bash /opt/bin/start-selenium-node.sh
seluser     26  5.1  1.2 7244440 129376 ?      Sl   20:30   0:03 java -jar /opt/selenium/selenium-server-standalone.jar -role node -hub http://selenium-hub:4444/grid/register -nodeConfig /opt/selenium/config.json
seluser     55  0.0  0.0  21188  3792 pts/0    Ss   20:31   0:00 bash
seluser    774  0.0  0.0  37360  3244 pts/0    R+   20:32   0:00 ps aux

So Xvfb won't run and you'll need to run tests with the headless flag set to true, e.g. in Java:

    @Test()
    public void firefoxTest() throws Exception {
        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.setHeadless(true);
        WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), firefoxOptions);
        driver.get("http://the-internet.herokuapp.com");
        Assert.assertEquals(driver.getTitle(), "The Internet");
        driver.quit();
    }

and for Chrome:

    @Test()
    public void chromeProfile() throws Exception {
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setHeadless(true);
        WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), chromeOptions);
        driver.get("http://the-internet.herokuapp.com");
        Assert.assertEquals(driver.getTitle(), "The Internet");
        driver.quit();
    }

Therefore you can now run the images without Xvfb. I will comment again when the images with this change are released and pushed to Docker Hub.

diemol added a commit that referenced this issue Oct 3, 2018
…#796)

wants to run Chrome and Firefox in headless mode and thinks that Xvfb
uses too many resources. Fixes #429 and fixes #567.
@diemol
Copy link
Member

diemol commented Oct 3, 2018

Released https://github.com/SeleniumHQ/docker-selenium/releases/tag/3.14.0-francium

@tnguyen14
Copy link
Contributor

@diemol if I understand this correctly, I can use headless, but in order to do debugging (with VNC), I would still need xvfb?

@graingert
Copy link
Contributor Author

graingert commented Oct 3, 2018 via email

@tnguyen14
Copy link
Contributor

Is there any specific instruction for how I can do that (open and see the video feed)?

@graingert
Copy link
Contributor Author

graingert commented Oct 3, 2018 via email

@lock lock bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.