Automating screenshots with Selenium

One of our web sites has a help section which includes screenshots of the web site itself. Needless to say, the screenshots quickly become out-of-date when we modify the site. After manually updating the screenshots a couple times, I decided to automate the process using Selenium and Python. This post describes: Setting up Selenium in a Python virtual environment Initializing the WebDriver Interacting with the web site Taking screenshots of specific elements Set up the virtual environment We’ll install Selenium in a new Python virtual environment. Selenium also requires a driver to interface with the browser which must be installed separately. ...

21 December, 2020 · Max Smolens

Cleaning up Django Migrations

In late 2019 I modernized a large Django 1.11/Python 2 application to use Django 2.2/Python 3. The application included hundreds of database migrations, many of which depended on legacy packages and deprecated functionality that blocked upgrading Django and Python. This post documents how I cleaned up the legacy migrations to unblock upgrading to modern versions of Django and Python. Attempt #1: Squash the migrations The standard way to reduce the number of migrations in Django is called squashing. Squashing generates new migrations that co-exist with the old migrations, which simplifies deploying the changes. ...

24 November, 2020 · Max Smolens