Fix possible race condition in selenium test?