Write a snapshot before each click; diagnose script errors.