创建包含用于Selenium的Firefox和Chrome驱动程序的Dockerfile [英] Create Dockerfile that includes Firefox and Chrome drivers for Selenium

查看:290
本文介绍了创建包含用于Selenium的Firefox和Chrome驱动程序的Dockerfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Dockerfile将会构建一个Selenium服务器

I have the following Dockerfile which will build a Selenium server

FROM selenium/standalone-firefox:3.4.0-chromium
FROM selenium/standalone-chrome

USER root
ENV NODE_ENV test

RUN mkdir -p /usr/local/cdt-tests/csv-data
COPY ./csv-data /usr/local/cdt-tests/csv-data
USER seluser

显然这两个FROM语句不正确 =>如何创建一个同时具有Chrome驱动程序和Firefox驱动程序的Selenium服务器容器。据我所知, selenium / standalone-firefox:3.4.0-chromium 图片仅适用于Firefox。

obviously the two FROM statements is incorrect => How can I create a Selenium server container that has both a Chrome driver and Firefox driver for Selenium. As far as I can tell, the selenium/standalone-firefox:3.4.0-chromium image only works for Firefox.

推荐答案

没有像您建议的那样为Dockerfiles设置继承类型。

There is no inheritance type setup for Dockerfiles like you are suggesting.

要实现组合版本,您需要找到独立的常见 FROM 祖先-firefox standalone-chrome ,即 selenium / node-base 并创建您的自己的Docker文件,以重新应用 selenium / standalone-chrome 应用的所有构建步骤。然后,每当Selenium更新其内部版本时,使其保持同步。

To implement a combined build you would need find the common FROM ancestor of the standalone-firefox and standalone-chrome, which is selenium/node-base and create your own Docker file to reapply all the build steps that selenium/standalone-chrome applies. Then keep it in sync whenever Selenium update their builds.

Dockerfile层次结构:

Dockerfile Hierarchy:

                selenium/node-base
                /               \
selenium/node-chrome          selenium/node-firefox
               |                 |
selenium/standalone-chrome    selenium/standalone-firefox

问题是这些版本已经设计为单独的,因此图像使用的变量和设置存在很大的重叠,您还需要在自定义版本中取消选择,以同时控制和运行chrome和firefox。

The problem is these builds have been designed to be seperate, so there is significant overlap in the variables and settings that the images use that you would also need to unpick in your custom build to control and run both chrome and firefox at the same time. You will probably end up having to do everything from scratch.

正在运行个人硒网格节点位于网格中心是从单个端点进行多浏览器测试的标准方法。您可以运行 Firefox Chrome 虚拟JS 节点或在Docker中连接标准节点

Running individual Selenium grid node's behind a grid hub is the standard way to do multi browser testing from a single endpoint. You can run Firefox, Chrome or Phantom JS nodes in Docker or connect standard nodes from anywhere else.

您始终可以在单独的端口上运行Chrome和Firefox容器,并指向同一个容器对于在每个浏览器上运行一些测试的简单情况,如果要设置网格,则在另一个端口上安装测试套件是一项繁重的工作。

You can always run a container for Chrome and Firefox on seperate ports and point the same test suite at a different port if setting up a Grid is a lot of work for the simple case of running some tests against each browser.

这篇关于创建包含用于Selenium的Firefox和Chrome驱动程序的Dockerfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆