Docker Community Forums

Share and learn in the Docker community.

Selenium not working in AWS Code Build

Hello -

We tried to run the Selenium testing in the AWS Codebuild and here’s the setup we made:

WebApp UI is running on localhost:80
Backend APIs are running on localhost:5000-5004

We were able to deploy and up the backend and frontend of WebApp. However, if we run the selenium testing using docker-compose, we encountered the below error message:

[36muiTestFirefox_1 |·[0m org.openqa.selenium.WebDriverException: connection refused

If we didn’t start/up the backend and frontend, the selenium testing is working fine. Question is, what’s causing the issue? I tried various test scenarios to fix the issue but no luck. Any inputs are highly appreciated. Thanks

Here’s the docker-compose we used:

version: “3”
services:
selenium-hub:
image: selenium/hub
networks:
vpcbr:
ipv4_address: 10.5.0.6
chrome:
image: selenium/node-chrome-debug
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
networks:
vpcbr:
ipv4_address: 10.5.0.7
firefox:
image: selenium/node-firefox-debug
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
networks:
vpcbr:
ipv4_address: 10.5.0.8
uiTestFirefox:
image: customdocker
depends_on:
- chrome
- firefox
environment:
- BROWSER=firefox
- HUB_HOST=selenium-hub
- MODULE=dockering.xml
volumes:
- ./output/firefox:/usr/share/udemy/test-output
networks:
vpcbr:
ipv4_address: 10.5.0.9
uiTestChrome:
image: customdocker
depends_on:
- chrome
- firefox
environment:
- BROWSER=chrome
- HUB_HOST=selenium-hub
- MODULE=dockering.xml
networks:
vpcbr:
ipv4_address: 10.5.0.10
networks:
vpcbr:
driver: bridge
ipam:
config:

  • subnet: 10.5.0.0/16