Nested packages do not load automatically; until you import selenium.webdriver , it is available as an attribute. Importing selenium alone is not enough.
Do it:
import selenium.webdriver driver = selenium.webdriver.Firefox()
Sometimes a package itself imports a nested package into the package initializer __init__.py ; os imports os.path , so os.path immediately available, even if you only import os .
source share