GithubHelp home page GithubHelp logo

atlassian / docker-chromium-xvfb Goto Github PK

View Code? Open in Web Editor NEW
394.0 11.0 125.0 129 KB

Docker image for running browser tests against headless Chromium

License: MIT License

Shell 33.65% Logos 9.07% Dockerfile 57.28%

docker-chromium-xvfb's Introduction

Chromium in Docker via Xvfb

This Docker image provides a way to run a real Chromium / Chrome browser headless inside of a Docker container. If you're looking for a way to run your Karma or Python Selenium tests against Chrome using Docker, this is the project you've been looking for! Use cases include:

  • Run Javascript tests with Karma inside of Docker during local development or CI builds
  • Run Selenium-powered browser automation tests using Python inside of Docker during your CI builds
  • and pretty much anything else where you'd want to use a real Chrome browser within a Docker container

Images

  • markadams/chromium-xvfb Base Docker image (Installs Debian, Chromium, Xvfb)
  • markadams/chromium-xvfb-js Designed for running headless JS tests in Chromium (includes iojs (node) and npm) This image automatically runs npm install and npm test
  • markadams/chromium-xvfb-py2 Designed for running headless Selenium tests in Chromium (Python 2) This image automatically runs pip install -r requirements.txt
  • markadams/chromium-xvfb-py3 Designed for running headless Selenium tests in Chromium (Python 3) This image automatically runs pip3 install -r requirements.txt

Methodology

The key to this project and to getting Chromium / Google Chrome to work inside of a container is the wrapper script, xvfb-chromium.

The wrapper script does a number of things:

  1. Launches the X virtual frame buffer (Xvfb) which emulates an X11 display so that the GUI code in the browser has a display to interact with.
  2. Launches Chromium / Google Chrome and passes along any command line arguments to the browser process.
  3. Traps SIGTERM and relays the signal to the browser and Xvfb so that they will not continue to run once the test runner is finished. This is mostly required to deal with Karma's insistence that the browser process be terminated before it can exit. Without this relaying, Karma would hang indefinitely.

Directories

  • /images - Contains the sources for all of the chromium-xvfb-* images
  • /samples - This image contains an example of running tests for JS / Karma and Selenium with Python 2 and 3.

Running the sample applications

  1. cd into any of the projects in /samples
  2. docker build -t sample .
  3. docker run sample

The sample application will run the example test and output its results to the console as well as a xunit-format XML file in the test-results/ directory inside of the container.

docker-chromium-xvfb's People

Contributors

johannesrudolph avatar mafrauen avatar mark-adams avatar mbertrand80 avatar mschwager avatar wbinnssmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-chromium-xvfb's Issues

No license

I'd quite like to reuse some of this in one of my projects (specifically: your xvfb-chromium script), but you don't include any licensing details in the repo, so I technically can't.

Assuming that you intended this to be open-source, any chance you could drop in an appropriate license?

Can't get selenium to use the wrapper script

Hi,

First let me apologize if this doesn't make sense, I have literally never used any of the technologies involved here (except for docker), I just agreed to help one of the dev teams rebase their custom container to something more maintained.

They use Capybara with Cucumber, and this then starts up a Selenium driver (against Chrome) to actually run the tests. When the tests kick in I get:

@test-suite
Feature: Smoke Test

  @smoke-test @login-IC @showDynamicProductStrategies
  Scenario: Configure one medical product and two groups # features/regression/build-smoke-test.feature:5
 unknown error: an X display is required for keycode conversions, consider using Xvfb
   (Session info: chrome=57.0.2987.98)
   (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-51-generic x86_64) (Selenium::WebDriver::Error::UnknownError)

I changed the configuration for capybara to:

Capybara.register_driver :selenium do |app| # sets the context of a web app
  Capybara::Selenium::Driver.new(app,
    browser:                 :chrome,
    :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(
      'chromeOptions' => {
        'binary' => '/usr/bin/google-chrome'
      }
    )
  ) # sets chrome as the browser

Trying to force it through the wrapper script but it still seems to fail. I know this isn't exactly a problem with your container, I am just literally begging for help here as I don't know what else to even do to troubleshoot this. Anything you could suggest would definitely be appreciated!

Chrome doesn't start

Hey, I'm struggling to make chrome start and found your repo so I thought to give it a try.
Unfortunately it doesn't seem to work :(

emmenko: ~/dev/src/docker-chromium-xvfb/samples/js (master)
$ docker run -it --rm -v $(pwd):/src -w /src markadams/chromium-xvfb-js
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info pretest [email protected]
npm info test [email protected]

> [email protected] test /src
> ./node_modules/karma/bin/karma start

INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (1/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (2/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.
npm info [email protected] Failed to exec test script
npm ERR! Test failed.  See above for more details.

Any idea what's wrong?

General Question about your efforts here

I'm new to selenium, docker, xvfb and sys admin stuff in general. I find this project more clear to use than the official selenium repo. I've actually not been able to wrap my head around how to actually layer their project into my stack. This project, however, is very intuitive to me and I was able to immediately look at your sample and figure it out.

So those are my reasons for attempting to build my own selenium-ready container...

What reasons do you have for not using the 'official' image?

What are your future goals / plans for this project, if any?

Also, if possible, do you think you could explain the non-obvious differences between this project and that? (Dont need you to tell me you dont have FireFox, for example :p)

Npm doesn't find git

Here my error with npm v3.10.6

npm ERR! not found: git
npm ERR! 
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

Google Chrome doesn't run solo

I expect this command to print out the HTML of a website:

docker-chromium-xvfb/images/base $ docker build -t chromium-xvfb . && docker run --rm --security-opt seccomp=unconfined chromium-xvfb /usr/bin/google-chrome --disable-gpu http://google.com

Instead, it just hangs. The run command outputs this information:

Xlib:  extension "RANDR" missing on display ":99".
[6:17:0404/164119.237190:ERROR:bus.cc(427)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Xlib:  extension "RANDR" missing on display ":99".

and the image has to be killed via docker kill. I can get rid of the dbus error with:

docker run --rm --security-opt seccomp=unconfined chromium-xvfb bash -c 'service dbus start && /usr/bin/google-chrome --disable-gpu http://google.com'

But I still just get a hung docker image. I've tested replacing http://google.com with a local URL and --net=host to ensure that it's not hitting the server, and it's not.

Any ideas for how I could get this to work, or to debug it further?

General use for other application

using the base image, should it be possible for other type of application? for example in my case, I'm using Golang and chromedp.

currently I'm trying this Dockerfile

FROM golang:1.11-alpine as builder
WORKDIR /app
COPY go.mod . 
COPY go.sum .

RUN apk add --no-cache ca-certificates git

# Get dependancies - will also be cached if we won't change mod/sum
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 GOARCH=amd64 go install -installsuffix "static" ./cmd/worker/app/...

FROM markadams/chromium-xvfb
COPY --from=builder /go/bin /bin
ENTRYPOINT ["/bin/app"]

Python 3 sample fails

Hey!

Interesting project you've got here! Who knew trying to run Selenium tests in a Docker container would be such a PITA?

So, I'm trying to run your sample images, and Python 2 works while Python 3 doesn't:

$ docker build -t sample-2 python2/
Sending build context to Docker daemon 4.608 kB
Step 1 : FROM markadams/chromium-xvfb-py2:latest-onbuild
# Executing 3 build triggers...
Step 1 : COPY requirements.txt /usr/src/app/requirements.txt
 ---> Using cache
Step 1 : RUN pip install -r requirements.txt
 ---> Using cache
Step 1 : COPY . /usr/src/app
 ---> Using cache
 ---> 477e657c73e4
Step 2 : RUN mkdir test-results
 ---> Using cache
 ---> 3d1115ee728b
Successfully built 3d1115ee728b
$ docker run sample-2
============================= test session starts ==============================
platform linux2 -- Python 2.7.9, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /usr/src/app, inifile: setup.cfg
collected 1 items

test_google.py .

--------- generated xml file: /usr/src/app/test-results/results.py.xml ---------
=========================== 1 passed in 2.61 seconds ===========================
$ docker build -t sample-3 python3/
Sending build context to Docker daemon 4.608 kB
Step 1 : FROM markadams/chromium-xvfb-py3:latest-onbuild
# Executing 3 build triggers...
Step 1 : COPY requirements.txt /usr/src/app/requirements.txt
 ---> Using cache
Step 1 : RUN pip3 install -r requirements.txt
 ---> Using cache
Step 1 : COPY . /usr/src/app
 ---> Using cache
 ---> a503c017e9ba
Step 2 : RUN mkdir test-results
 ---> Using cache
 ---> 57808ed4257e
Successfully built 57808ed4257e
$ docker run sample-3
============================= test session starts ==============================
platform linux -- Python 3.4.2, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /usr/src/app, inifile: setup.cfg
collected 1 items

test_google.py FE

--------- generated xml file: /usr/src/app/test-results/results.py.xml ---------
==================================== ERRORS ====================================
__ ERROR at teardown of ExampleTests.test_google_title_matches_correct_value ___

self = <test_google.ExampleTests testMethod=test_google_title_matches_correct_value>

    def tearDown(self):
>       self.driver.close()

test_google.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/webdriver.py:510: in close
    self.execute(Command.CLOSE)
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/webdriver.py:234: in execute
    response = self.command_executor.execute(driver_command, params)
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/remote_connection.py:408: in execute
    return self._request(command_info[0], url, body=data)
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/remote_connection.py:439: in _request
    self._conn.request(method, parsed_url.path, body, headers)
/usr/lib/python3.4/http/client.py:1090: in request
    self._send_request(method, url, body, headers)
/usr/lib/python3.4/http/client.py:1128: in _send_request
    self.endheaders(body)
/usr/lib/python3.4/http/client.py:1086: in endheaders
    self._send_output(message_body)
/usr/lib/python3.4/http/client.py:924: in _send_output
    self.send(msg)
/usr/lib/python3.4/http/client.py:859: in send
    self.connect()
/usr/lib/python3.4/http/client.py:836: in connect
    self.timeout, self.source_address)
/usr/lib/python3.4/socket.py:509: in create_connection
    raise err
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

address = ('127.0.0.1', '43205'), timeout = <object object at 0x7f80cb82d0e0>
source_address = None

    def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
                          source_address=None):
        """Connect to *address* and return the socket object.
    
        Convenience function.  Connect to *address* (a 2-tuple ``(host,
        port)``) and return the socket object.  Passing the optional
        *timeout* parameter will set the timeout on the socket instance
        before attempting to connect.  If no *timeout* is supplied, the
        global default timeout setting returned by :func:`getdefaulttimeout`
        is used.  If *source_address* is set it must be a tuple of (host, port)
        for the socket to bind as a source address before making the connection.
        An host of '' or port 0 tells the OS to use the default.
        """
    
        host, port = address
        err = None
        for res in getaddrinfo(host, port, 0, SOCK_STREAM):
            af, socktype, proto, canonname, sa = res
            sock = None
            try:
                sock = socket(af, socktype, proto)
                if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
                    sock.settimeout(timeout)
                if source_address:
                    sock.bind(source_address)
>               sock.connect(sa)
E               ConnectionRefusedError: [Errno 111] Connection refused

/usr/lib/python3.4/socket.py:500: ConnectionRefusedError
=================================== FAILURES ===================================
_____________ ExampleTests.test_google_title_matches_correct_value _____________

self = <test_google.ExampleTests testMethod=test_google_title_matches_correct_value>

    def test_google_title_matches_correct_value(self):
>       self.driver.get("http://www.google.com")

test_google.py:11: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/webdriver.py:248: in get
    self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/webdriver.py:234: in execute
    response = self.command_executor.execute(driver_command, params)
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/remote_connection.py:408: in execute
    return self._request(command_info[0], url, body=data)
/usr/local/lib/python3.4/dist-packages/selenium/webdriver/remote/remote_connection.py:440: in _request
    resp = self._conn.getresponse()
/usr/lib/python3.4/http/client.py:1172: in getresponse
    response.begin()
/usr/lib/python3.4/http/client.py:351: in begin
    version, status, reason = self._read_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <http.client.HTTPResponse object at 0x7f80c80939e8>

    def _read_status(self):
        line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
        if len(line) > _MAXLINE:
            raise LineTooLong("status line")
        if self.debuglevel > 0:
            print("reply:", repr(line))
        if not line:
            # Presumably, the server closed the connection before
            # sending a valid response.
>           raise BadStatusLine(line)
E           http.client.BadStatusLine: ''

/usr/lib/python3.4/http/client.py:321: BadStatusLine
============================ pytest-warning summary ============================
WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.
============= 1 failed, 1 pytest-warnings, 1 error in 1.86 seconds =============

This is coming from an Ubuntu 16.04 machine, with Docker version:

$ docker version
Client:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   6b644ec
 Built:        Mon, 19 Dec 2016 09:20:48 +1300
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   6b644ec
 Built:        Mon, 19 Dec 2016 09:20:48 +1300
 OS/Arch:      linux/amd64

JS sample doesn't run

On a clean checkout of your repo, I get:

~/code/docker-chromium-xvfb/samples/js $ docker build -t xvfb-sample . && docker run xvfb-sample
Sending build context to Docker daemon 6.144 kB
Step 1/1 : FROM markadams/chromium-xvfb-js:7-onbuild
# Executing 3 build triggers...
Step 1/1 : COPY package.json /usr/src/app/package.json
 ---> Using cache
Step 1/1 : RUN npm install
 ---> Using cache
Step 1/1 : COPY . /usr/src/app
 ---> Using cache
 ---> 2f33936ff9d4
Successfully built 2f33936ff9d4

> [email protected] test /usr/src/app
> ./node_modules/karma/bin/karma start

/usr/src/app/node_modules/socket.io/lib/store.js:35
Store.prototype.__proto__ = EventEmitter.prototype;
                                        ^

TypeError: Cannot read property 'prototype' of undefined
    at Object.<anonymous> (/usr/src/app/node_modules/socket.io/lib/store.js:35:41)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/src/app/node_modules/socket.io/lib/manager.js:16:13)
    at Module._compile (module.js:571:32)
npm ERR! Test failed.  See above for more details.

~/code/docker-chromium-xvfb/samples/js $ docker --version
Docker version 17.03.1-ce, build c6d412e

~/code/docker-chromium-xvfb/samples/js $ uname -a
Darwin hickory.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

E2E using Protractor

Hello,

I tried the Image to build a custum container that is expected to run e2e Test using Protractor, not Karma.
Using your Instructions I added npm global Installations for webdriver and protractor. When the container gets up, it yields:

root@gitlab2-VirtualBox:/home/tp-docker/git/docker-chromium# docker run --name e2e e2e-chr Xlib: extension "RANDR" missing on display ":99". [7:16:0524/071954.451043:ERROR:bus.cc(427)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory Xlib: extension "RANDR" missing on display ":99". libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted [51:51:0524/071954.830454:ERROR:child_thread_impl.cc(762)] Request for unknown Channel-associated interface: ui::mojom::GpuMain [7:32:0524/071954.831926:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel. [7:32:0524/071954.832024:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel. [7:32:0524/071954.833349:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel. [7:32:0524/071954.834286:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel. [7:32:0524/071954.834625:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel. libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted

Afterwards, the container hangs just, doing nothing more.
Is it even possible to use the Image with Protractor?

Send keys option is not working.

Hii Adams,

  • We used your image(python2) to run the selenium test cases.
  • image
  • In single file, we wrote two test cases
    1: One with send keys,
    2: Another one without sending keys.
  • The test case without using send keys is passed and another one with sending keys is failed.
  • Test_case file link
  • This is the final output
test_google_with_send_keys (testing.ExampleTests) ... ERROR
test_google_without_send_keys (testing.ExampleTests) ... ok

======================================================================
ERROR: test_google_with_send_keys (testing.ExampleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tests/testing.py", line 19, in test_google_with_send_keys
    input_box.send_keys('apple', Keys.RETURN)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 349, in send_keys
    'value': keys_to_typing(value)})
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 493, in _execute
    return self._parent.execute(command, params)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: an X display is required for keycode conversions, consider using Xvfb
  (Session info: chrome=57.0.2987.98)
  (Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 3.13.0-38-generic x86_64)


----------------------------------------------------------------------
Ran 2 tests in 15.282s

FAILED (errors=1)


  • Can you please suggest how can we resolve this issue.Thanks!

extension "RANDR" missing on display ":99".

Hello there.

Trying Docker and your image for the first time, so please bear with, I may have not got it right
So here is what I've done after installing Docker on Ubuntu and installed your image

sudo docker run -i -t markadams/chromium-xvfb /bin/bash

after what I have checked the Chromium browser

root@6f8cc76b7173:/app# which chromium-browser
/usr/bin/chromium-browser

root@6f8cc76b7173:/app#  ls -al /usr/bin/chromium-browser
lrwxrwxrwx 1 root root 22 Apr  7 19:30 /usr/bin/chromium-browser -> /usr/bin/xvfb-chromium

Errors when starting Chromium

root@6f8cc76b7173:/app# chromium-browser 
[119:119:0414/140658:ERROR:browser_main_loop.cc(217)] Running without the SUID sandbox! See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.
Xlib:  extension "RANDR" missing on display ":99".
[130:130:0414/140659:ERROR:image_metadata_extractor.cc(114)] Couldn't load libexif. libexif.so.12: cannot open shared object file: No such file or directory
[119:132:0414/140659:ERROR:bus.cc(432)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[119:132:0414/140659:ERROR:bus.cc(432)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Xlib:  extension "RANDR" missing on display ":99".
[119:119:0414/140659:ERROR:desktop_window_tree_host_x11.cc(891)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)
[161:161:0414/140659:ERROR:sandbox_linux.cc(334)] InitializeSandbox() called with multiple threads in process gpu-process
[119:143:0414/140659:ERROR:browser_gpu_channel_host_factory.cc(145)] Failed to create channel.

Note the extension "RANDR" missing on display ":99".

then Couldn't load libexif

and Failed to connect to socket

are these none critical errors?

Any reasons not to use Alpine

Image size would be dramatically less Alpine.

Example Dockerfile:

FROM alpine:3.8

RUN apk add --no-cache chromium

RUN addgroup -S chromium && adduser -S chromium -G chromium

USER chromium

EXPOSE 9222

ENTRYPOINT ["chromium-browser", "--no-sandbox", "--disable-gpu", "--headless"]
CMD ["--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222"]

When taking screenshots via selenium, Images are broken

When taking screenshots via selenium, Images are broken.

For example using below command when Next website is fully loaded
driver.get_screenshot_as_file("Next1.png")
image

BTW, when testing the same code outside the docker, images are presented well

No such file or directory, open '/app/package.json'

When using your "onbuild" js container I always get:

no such file or directory, open '/app/package.json'

I think this has to do with the fact that this container extends the base container which sets the WORKDIR as /app but npm install needs to be run from /app/src?

html format instead of xml

Hi! How can we switch the tool:pytest to be in html, just need to send it out by mail formatted and in xml I miss all the breaklines T_T

exec "chrome --version" wait and no response.

In my case, I use vue and vue-cli as 4.0.0 version.

When exec "vue-cli-service build" to build, vue-cli will check chrome version with "chrome --version", so build process will wait and timeout.

expect: chrome --version log the version and not wait.

Problem running docker-chromium-xvfb

Hi

Running a python test script, I get:

Traceback (most recent call last):
File "mcanvas-login-test.py", line 19, in testLogin
element.send_keys(os.getenv('MCANVAS_TEST_EMAIL'))
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 320, in send_keys
self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': keys_to_typing(value)})
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: an X display is required for keycode conversions, consider using Xvfb
(Session info: chrome=52.0.2743.116)
(Driver info: chromedriver=2.19.346067 (6abd8652f8bc7a1d825962003ac88ec6a37a82f1),platform=Linux 4.4.14-moby x86_64)

Any ideas? I tried just going to a page and checking the page title and everything worked, so I thin it's all installed OK.

Thanks, Roger

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.