Exception handling in Selenium Python