Notice that the Start Session keyword determines which type of browser to open - either a local or remote one. This demo of using Selenium and Docker for test automation will use the following tools and technology: Python, binded with Selenium WebDriver. I will explain how to use docker selenium and. use selenium/standalone-chrome from selenium. *** Variables *** $ Set Window Size 2048 2048 Fetch Url login Add Cookie robot true Register Keyword To Run On Failure Error Data End Session Close Browser Logout Fetch Url logout The pre-requisite step to run a Selenium test in a Docker container is installing Docker as well as using the right tools in your tech stack. Installing unzip as we will need for the zipped Chrome Driver. After much experimentation, I was able to get the connections between everything to work.įirst, we need to have the chromedriver container running: Then create the Dockerfile in the same directory like this: FROM joyzoursky/python-chromedriver:3.6-alpine3.7 RUN mkdir packages ADD requirements.txt packages RUN pip install -r packages/requirements.txt Then build the image: docker build -t yourimage. But getting that to work with robot was still a bunch of work. I did find a docker image that just has an instance of chromedriver, and exposes that. Even just appending new stuff to them means that things could turn out to be a pain in the arse to manage.Īnd getting chromedriver installed into a docker image is not neat. We already use docker for deployment, but I didn’t really want to build a bunch of distinct images just for testing that re-implemented the same stuff that we have in our deployment images. Once you install the Docker, open the command prompt and type. If you want to see the logs of the container, you can use the below command. Step-3: The Docker daemon created a new container from that image. Step-2: The Docker daemon pulled the hub image from the Docker Hub. Which has some neater features, but required me to build docker images for everything. Step-1: The Docker client contacted the Docker daemon. It was all good, because chromedriver and all it’s dependencies were already installed.īut time passes, and we needed to move to Codeship Pro. At the time, we were using Codeship Basic, and I built a helper to run a robot test suite within a tox environment. One of my team implemented RobotFramework support for automated browser testing of our platform a while ago. RobotFramework, Chromedriver and Docker.
0 Comments
Leave a Reply. |