Listen for javascript events to allow easier automation.