docker-selenium:具有Chrome和Firefox以及视频录制支持的Docker中的Selenium。 还要检查:

  • w0_728705
    了解作者
  • 1.4MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-18 04:28
    上传日期
带有Chrome和Firefox的Docker中的Selenium 具有2个节点的Selenium服务器网格(chrome和firefox) mp4录像 VNC访问(用于调试容器) 谷歌Chrome稳定 google-chrome-beta:不再提供,但 google-chrome-unstable:已不再提供,但 火狐稳定最新 火狐稳定的 fluxbox(仍可在找到openbox窗口管理器) Selenium 3 docker run ... elgalu/selenium:latest Selenium 2 docker run ... elgalu/selenium:2不再维护 目的 该项目的目的是使尽可能简单快速地运行。 扩大了此目的,该项目使用此项目提供 -selenium。 还会在必要时将测试转发给云提供商(Sauce Labs,BrowserStack,TestingBot和LambdaTest)。 官方回购 注意和这一个具有相同的目的,但是在过去两年中这两个项目有很大的不同,一些主要区别是: 浏览器和网格都在此仓库中的同一容器中 支持 流程经理:此图像
docker-selenium-master.zip
内容介绍
# Selenium in Docker with Chrome and Firefox [![Build Status](https://travis-ci.org/elgalu/docker-selenium.svg?branch=master)](https://travis-ci.org/elgalu/docker-selenium "Travis CI") [![Docker Pulls](https://img.shields.io/docker/pulls/elgalu/selenium.svg)](https://hub.docker.com/r/elgalu/selenium/tags/) [![Docker](https://images.microbadger.com/badges/version/elgalu/selenium.svg)](https://microbadger.com/images/elgalu/selenium "Docker Badge") [![Analytics](https://ga-beacon.appspot.com/UA-18144954-10/github/elgalu/docker-selenium/README.md)](https://github.com/igrigorik/ga-beacon "Analytics") [![Gitter](https://badges.gitter.im/elgalu/selenium.svg)](https://gitter.im/elgalu/docker-selenium "Chat support") * selenium server grid with 2 nodes (chrome & firefox) * mp4 video recording * VNC access (useful for debugging the container) * google-chrome-stable * google-chrome-beta: no longer provided but [can still be found here][2.47.1m] * google-chrome-unstable: no longer provided but [can still be found here][2.47.1m] * firefox stable latest * firefox stable [last 18 versions can be found here][2.47.1m] * fluxbox (openbox window manager can still be found [here](https://github.com/elgalu/docker-selenium/releases/tag/3.0.1c)) Selenium 3 `docker run ... elgalu/selenium:latest` ![docker-selenium-grid](./images/grid3_console.png) Selenium 2 `docker run ... elgalu/selenium:2` **no longer maintained** ### Purpose The purpose of this project is to have [Selenium][] running as simple and as fast as possible. This purpose is augmented by [Zalenium][] a project which uses this one to provide docker-selenium(s) on-demand. [Zalenium][] also forwards tests to a Cloud Provider (Sauce Labs, BrowserStack, TestingBot & LambdaTest) when necessary. <h2 id="official">Official repo</h2> Note [SeleniumHQ/docker-selenium](https://github.com/SeleniumHQ/docker-selenium) and this one share the same purpose however both projects have diverged considerably in the last two years, some major differences are: * both browsers and also the grid are on the same container in this repo * support for [video recording](./docs/videos.md) * process manager: this image uses [supervisord](http://supervisord.org) while the official [uses bash](https://github.com/SeleniumHQ/docker-selenium/blob/master/StandaloneChromeDebug/entry_point.sh) Even though both projects share the same purpose is good to have alternatives, see also for example [docker-alpine-selenium](https://github.com/SUNx2YCH/docker-alpine-selenium). Letting more than 1 docker-selenium project grow to be able to learn from each other's success or failures ultimately impacts the final users positively. This doesn't discard that at some point all selenium maintainers will sit together a sprint to coordinate some major changes and cleanup open issues and perhaps we might merge N similar projects in the future. ### Statistics [![ga-datastudio-docker-selenium](./images/ga-datastudio-docker-selenium.png)](https://datastudio.google.com/open/0B3GcHpfNB6-FRDd3RWo1ZWh4N3M "Docker-Selenium usage stats v1") ### Alternatives If you don't require video recording we suggest to use either [Google Chrome in headless mode](https://chromium.googlesource.com/chromium/src/+/master/headless/README.md) or [Firefox in headless mode](https://developer.mozilla.org/en-US/Firefox/Headless_mode). We also recommend avoiding [PhantomJS](https://github.com/ariya/phantomjs) as maintenance was stopped after Chrome & Firefox headless became available. You can also use a paid service like [Sauce Labs][sauce], [BrowserStack] or [LambdaTest][], note they offer free open source accounts and straightforward [integration with Travis CI](https://docs.travis-ci.com/user/sauce-connect/). ### Requisites This project is normally tested in the last version of Docker and docker-compose and also in the release candidates. To figure out the currently used specific versions it surely works on, see file [.travis.yml](./.travis.yml) example values: docker --version #=> 17.09.0-ce docker-compose --version #=> 1.16.1 If you need to use docker-machine to run docker (like for example on a Mac before the Docker native version 1.12), you also need to install VirtualBox and then run these commands to get started: ```sh docker-machine create --driver virtualbox default eval "$(docker-machine env default)" ``` You will need to run the second `eval` command for every new terminal window. ### Usage <h4 id="run"> Run</h4> 1. Pull the image and run the container docker pull elgalu/selenium #upgrades to latest if a newer version is available docker run -d --name=grid -p 4444:24444 -p 5900:25900 \ -e TZ="US/Pacific" -v /dev/shm:/dev/shm --privileged elgalu/selenium 2. Wait until the grid starts properly before starting the tests _(Optional but recommended)_ docker exec grid wait_all_done 30s # Or if docker exec is not available (eg. circleci) wget --retry-connrefused --no-check-certificate -T 30 http://localhost:4444/grid/console -O /dev/null After this, [Selenium][] will be up and ready to accept clients at `http://localhost:4444/wd/hub`. The grid's available browsers can be viewed by opening the console at `http://localhost:4444/grid/console`. If you are using Mac (OSX) or [Microsoft Windows](https://docs.docker.com/engine/installation/windows/) `localhost` won't work unless you are in Docker Beta (version >= 1.12) If you are using Docker version <= 1.11 please find out the correct IP through `docker-machine ip default`. **Notes:** * The new default `VNC_PASSWORD=no` will make it VNC passwordless accessible. * Once this [docker feature](https://github.com/docker/docker/pull/22719) is in place `wait_all_done` won't be necessary anymore. #### Stop Shutdown gracefully docker exec grid stop docker stop grid Shutdown immediately, no mercy docker rm -vf grid ### Docker Compose See [docker-compose](./docs/docker-compose.md) ### Jenkins See [jenkins](./docs/jenkins.md) ### Parallel We now have a better suited product for this use case, is called [Zalenium][] This image is designed to run one test on each docker container but if you still want to run multiple tests in parallel you can still do so with [Zalenium][] If you want to limit yourself to this project, you still can. There are some ways to do it: 1. The recommended way is via [docker-compose](./docs/docker-compose.md) and you should replace `mock` with your web service under test within the [docker-compose-tests.yml][] file. docker-compose -f docker-compose-tests.yml -p grid up --force-recreate docker-compose -f docker-compose-tests.yml -p grid scale mock=1 hub=1 chrome=3 firefox=3 1. The _(not recommended)_ way is by increasing `MAX_INSTANCES` and `MAX_SESSIONS` which now [defaults](https://github.com/elgalu/docker-selenium/blob/2.53.1a/Dockerfile#L967) to 1. docker run -d --name=grid -p 4444:24444 -p 5900:25900 \ -v /dev/shm:/dev/shm --privileged \ -e MAX_INSTANCES=20 -e MAX_SESSIONS=20 \ elgalu/selenium The drawback is that all tests will run on the same desktop meaning the video recording will only capture the browser in the foreground but it's in the roadmap to make all this transparent, see issues [#78](https://github.com/elgalu/docker-selenium/issues/78) and [#77](https://github.com/elgalu/docker-selenium/issues/77). Another problem with increasing `MAX_INSTANCES` & `MAX_SESSIONS` is focus issues. So in this case is better scale up/down via [docker-compose](./docs/docker-compose.md). ### OSX If you are in Mac, you need to get the correct IP of the docker machine. One of these two commands should work to get it: docker-machine ip default or former: boot2docker ip ### Screen size You can set a custom screen size at docker run tim
评论
    相关推荐