Skip to content

Automating with Selenium

Benjamin Bearce edited this page Apr 1, 2024 · 8 revisions

Automation

What and Why

It's useful to test various parts of the system with lots of data or many intricate actions. The selenium tests do this generally and are used as a guide for this tutorial. One problem is that Selenium needs to launch an instance of a browser to control. Our tests do this inside a docker container and uses a test database that doesn't persist as it cleans up after itself. We need to be able to control a live codabench session that is running. To do that we a driver locally which is normally only inside the selenium docker container during tests. It is specific to your browser so kep that in mind.

Virtualenv

You'll need a python virtual env as you don't want to be inside django or you won't be able to launch a browser.

Virtualenv

I used 3.8.

python3 -m venv codabench
source ./codabench/bin/activate

Pyenv

pyenv install 3.8
pyenv virtualenv 3.8 codabench
pyenv activate codabench

Requirements

We have a couple extra things like webdriver-manager for getting a driver programatically and selenium needs to be upgraded to use modern client interface.

pip install -r requitements.txt
pip install -r requitements.dev.txt
pip install webdriver-manager
pip install --upgrade selenium
Clone this wiki locally