无法在Docker容器中运行Python UI测试

时间:2020-06-18 11:44:47

标签: python docker selenium dockerfile pytest

我的堆栈:Python 3.6.8 + Pytest + Selenium 3.141.0 我测试了安装在本地主机上的Jetbrains YouTrack应用程序。所有端口均打开。 我创建了Dockerfile并构建了容器:

FROM python:3.6.8
LABEL author=ivan_chistov
WORKDIR /tests
COPY . .
RUN apt update
RUN apt install python3-pip -y
RUN pip3 install -r requirements.txt
CMD pytest -v --alluredir=allure-report

首先,我开始使用selenium / standalone-chrome:3.141.59 docker run -d -p 4444:4444 container_name

之后,我尝试通过以下方式运行容器:docker run --rm --network host container_name

但是我遇到很多错误:

/bin/sh: 1: google-chrome: not found
/bin/sh: 1: google-chrome-stable: not found
ValueError(f'Could not get version for Chrome with this command: {cmd}')
Could not get version for Chrome with this command: google-chrome --version || google-chrome-stable --version

如何通过测试运行容器?为什么我会出错? 错误在哪里以及如何调试?

0 个答案:

没有答案