Silence warnings when selenium is not installed

Move selenium imports from the module toplevel to functions to avoid warnings when selenium is not installed.

While at it, fix the import of `selenium.webdriver.common.exceptions` to import `from selenium.common.exceptions` instead. I wonder how it has ever worked, as `WebDriverException` has lived in that module since selenium 2.0 beta.