Docker-selenium: PhantomJS Doesn't Join Grid Hub

Created on 18 Apr 2017  路  4Comments  路  Source: SeleniumHQ/docker-selenium

Meta -

Image(s): selenium/node-phantomjs:3.3 and selenium/hub:3.3

Docker Version: 17.03.1-ce-mac5 (16048)

OS: macOS Sierra

Expected Behavior -

PhantomJS should join the Grid Hub.

Actual Behavior -

PhantomJS doesn't join Grid Hub.

See my docker-compose configuration. Firefox does join, but PhantomJS doesn't. See attached screenshot from Grid Console. Thanks!

-Peter

version: '2'
services:
  selenium-hub:
    image: "selenium/hub:3.3"
    ports:
      - "127.0.0.1:4444:4444"
    restart: always
    environment:
      GRID_TIMEOUT: 30
      GRID_BROWSER_TIMEOUT: 60
  js1:
    image: "selenium/node-phantomjs:3.3"
    links:
      - "selenium-hub:hub"
    restart: always
    environment:
      HUB_PORT_4444_TCP_ADDR: selenium-hub
      HUB_PORT_4444_TCP_PORT: 4444
  ff1:
    image: "selenium/node-firefox:3.3"
    links:
      - "selenium-hub:hub"
    restart: always
    environment:
      HUB_PORT_4444_TCP_ADDR: selenium-hub
      HUB_PORT_4444_TCP_PORT: 4444

screen shot 2017-04-18 at 1 20 26 pm

Most helpful comment

Hi @peterstory

I got @madhavajay 's container to work with compose as follows:

hub:
        image: selenium/hub:3.1.0-astatine
        ports:
            - "4444:4444"
        networks:
            - seleniumGrid
phantomjs:
        image: madhavajay/selenium-node-phantomjs
        depends_on:
            - hub
        environment:
            - PORT=5555
            - HUB=http://hub:4444
        networks:
            - seleniumGrid
        entrypoint: 'bash -c "phantomjs /home/phantomjs/ghostdriver/src/main.js --hub=$$HUB --port=$$PORT --ip=`hostname -I | cut -d\" \" -f1` --remoteHost=http://$$HOSTNAME:5555"'

Thanks @madhavajay

All 4 comments

@peterstory This could be an issue with the ghostdriver, I actually submitted a patch to the ghostdriver that fixes this exact issue when you try to connect to a remote grid which is not hosted on the same local machine.

https://github.com/jesg/ghostdriver/commit/6e0e1f7088b11cff7a8810210a17ce1530302887

I also made a docker container which has the patched ghostdriver with my edit you can use to test this.

https://github.com/madhavajay/selenium-node-phantomjs

My param --remoteHost=http://x.x.x.x:5555 should be merged into the main ghostdriver project and that should be making its way into new builds of phantomjs.

However, the maintainer of phantomjs stepped down recently and I don't know whats happening with the final 2.5 release.

Theres a separate chat about adding chrome headless to selenium docker for this exact reason:
https://github.com/SeleniumHQ/docker-selenium/issues/429

Let me know if this doesn't fix your issue. :)

Hi @peterstory

I got @madhavajay 's container to work with compose as follows:

hub:
        image: selenium/hub:3.1.0-astatine
        ports:
            - "4444:4444"
        networks:
            - seleniumGrid
phantomjs:
        image: madhavajay/selenium-node-phantomjs
        depends_on:
            - hub
        environment:
            - PORT=5555
            - HUB=http://hub:4444
        networks:
            - seleniumGrid
        entrypoint: 'bash -c "phantomjs /home/phantomjs/ghostdriver/src/main.js --hub=$$HUB --port=$$PORT --ip=`hostname -I | cut -d\" \" -f1` --remoteHost=http://$$HOSTNAME:5555"'

Thanks @madhavajay

@peterstory,
As this is not a docker-selenium issue, could you please close it?

Thanks for figuring out how to get it working! With PhantomJS seeming to be on the way out, I've actually settled on using the Firefox images (at least until Chrome headless becomes available), despite the higher memory usage.

Was this page helpful?
0 / 5 - 0 ratings