Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🌈

Klaus Alexander Seistrup kseistrup

💭
🌈
View GitHub Profile
@kseistrup
kseistrup / selenium-screenshotting.md
Created Mar 25, 2016 — forked from dannguyen/selenium-screenshotting.md
Using Selenium and Python to screenshot a javascript-heavy page
View selenium-screenshotting.md

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](https://gist.github.com/dannguyen/8a6fa49253c1d6a0eb92

View ciphers.sh
#!/usr/bin/env bash
# OpenSSL requires the port number.
SERVER=$1:443
# Delay after each test
DELAY=0
# Ciphers to test
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
# Some nice colours :)
View aob.py
#!/usr/bin/python
# Audio extraction script for All of Bach:
# http://allofbach.com/en/
import re
import urllib2
from BeautifulSoup import BeautifulSoup
page = urllib2.urlopen('http://allofbach.com/en/bwv/')
soup = BeautifulSoup(page)