Exception handling in selenium