环境:doker/selenium/standalone-chrome:89.0
试试https://github.com/SeleniumHQ/docker-selenium。在
它安装了python:
$ docker run selenium/standalone-chrome python3 version
Python 3.5.2
说明书上说你从
编辑:
为了让selenium在python中运行,需要安装下面的包。创建此Dockerfile:
FROM selenium/standalone-chrome
USER root
RUN apt-get install python3-distutils
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3 get-pip.py
RUN python3 -m pip install selenium
然后你可以用
docker build . -t selenium-chrome && \
docker run -it selenium-chrome python3
与普通的pythondocker映像相比的优势是,您不需要安装chromedriver本身,因为它来自selenium/standalone-chrome。在
文章介绍了如何在Docker环境下使用selenium/standalone-chrome镜像来运行Python3,并自动安装所需库。通过创建Dockerfile安装python3和selenium,免去手动安装chromedriver的步骤。
553

被折叠的 条评论
为什么被折叠?



