folks! I have a task to run Python selenium tests in docker. First of all I run Selenium grid with docker-compose:
version: "3"
services:
selenium-hub:
image: selenium/hub:3.141.59-gold
container_name: selenium-hub
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome-debug
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
ports:
- 4577
firefox:
image: selenium/node-firefox-debug
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
ports:
- 4578
Then I build container where I install pytest and copy my test framework
FROM python:3.7-alpine3.8
COPY . .
RUN pip install -r requirements.txt
# update apk repo
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.8/community" >> /etc/apk/repositories
# install chromedriver
RUN apk update
RUN apk add chromium chromium-chromedriver
EXPOSE 3000
ENV PORT 3000
# install selenium
RUN pip install selenium==3.13.0
Then I tried to run my test file inside container:
# docker run 3ae7b37d8a7f pytest tests/basic_smoke_test.py --browser docker -v
A a result I see network error:
urllib.error.URLError: <urlopen error [Errno 99] Address not available>
Aucun commentaire:
Enregistrer un commentaire