如何将selenium测试脚本结果保存到本地主机中



以下是dockerfile和docker组合文件:

Dockerfile:
FROM python:alpine3.6
RUN pip install selenium
docker-compose.yml
version: "2.0"
services:
test:
image: selenium_python:v1
volumes:
- ./test.py:/test_script/test.py
command: python /test_script/test.py > /home/result/result.txt
depends_on:
- chrome
chrome:
image: selenium/standalone-chrome:latest
ports:
- "4444:4444"

试图运行脚本,但结果似乎没有保存到本地主机

您已经完成了一半,只需装载一个本地目录并将输出发送到那里。

例如/tmp:

...
services:
test:
image: selenium_python:v1
volumes:
- ./test.py:/test_script/test.py
- /tmp:/tmp
command: python /test_script/test.py > /tmp/result.txt
...

最新更新