美文网首页
重做selenium docker镜像

重做selenium docker镜像

作者: 星与星辰 | 来源:发表于2020-05-11 17:54 被阅读0次

selenium官方发布了docker镜像,非常好用,支持浏览器:chrome、firefox、opera,同时还支持vnc查看测试界面,这样想要进行selenium UI测试,就不用搭建selenium测试环境了,并且可以很容易的做测试并发。

selenium官方镜像地址:https://github.com/SeleniumHQ/docker-selenium#debugging

有时候,需要重做镜像,增加一些内容,

selenium容器使用Supervisor(Linux/Unix系统下的一个进程管理工具)管理进程,所以如果要增加启动进程,需要在Supervisor的配置文件中增加,如我想在容器中增加novnc的部署,从而可以通过web的方式访问容器内部的vnc端口,具体操作步骤为:

1、拉取selenium镜像

docker pull selenium/node-firefox-debug:3.141.59-zirconium

2、获取容器中的Supervisor配置文件selenium.conf和selenium-debug.conf,增加novnc的启动配置

3、写dockerfile,重建容器

在Dockerfile同级目录下存放:noVNC.tgz、selenium.conf、selenium-debug.conf、sources.list

# base image

FROM selenium/node-firefox-debug:3.141.59-zirconium

# MAINTAINER

MAINTAINER nianhua.zhou<nianhua.zhou@guanaitong.com>

# copy novnc

ADD noVNC.tgz /opt

# update sources.list

ADD sources.list /etc/apt/

ADD selenium.conf /etc/supervisor/conf.d

ADD selenium-debug.conf /etc/supervisor/conf.d

# install package

RUN sudo apt-get update && sudo apt-get install xdotool -y

EXPOSE 5900 6080

4、重建容器

docker build -t selenium/node-firefox-debug:3.141.60-rock .

相关文章

网友评论

      本文标题:重做selenium docker镜像

      本文链接:https://www.haomeiwen.com/subject/rxmunhtx.html