Skip to content

Instantly share code, notes, and snippets.


Klaus Alexander Seistrup kseistrup

View GitHub Profile
kseistrup /
Created Mar 25, 2016 — forked from dannguyen/
Using Selenium and Python to screenshot a javascript-heavy page

Using Selenium and Python to screenshot a javascript-heavy page

As websites become more JavaScript heavy, it's harder to automate things like screenshotting for archival purposes. I've seen examples and suggestions to use PhantomJS for visual testing/archiving of websites, but have run into issues such as the non-rendering of webfonts. I've never tried out Selenium until today...and while I'm not thinking about performance implications yet, Selenium seems far more accurate than PhantomJS...which makes sense since it actually opens a real browser. And it's not too hard to script to do complex interactions: here's an [example of how to log in to Twitter, write a tweet, upload an image, and send a tweet via Selenium and DOM element selection](

#!/usr/bin/env bash
# OpenSSL requires the port number.
# Delay after each test
# Ciphers to test
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
# Some nice colours :)
# Audio extraction script for All of Bach:
import re
import urllib2
from BeautifulSoup import BeautifulSoup
page = urllib2.urlopen('')
soup = BeautifulSoup(page)