Note
This is not an official documentation. Official API documentation is available here.
This chapter covers all the interfaces of Selenium WebDriver.
Recommended Import Style
The API definitions in this chapter show the absolute location of classes. However, the recommended import style is as given below:
from selenium import webdriver
Then, you can access the classes like this:
webdriver.Firefox webdriver.FirefoxProfile webdriver.FirefoxOptions webdriver.FirefoxService webdriver.Chrome webdriver.ChromeOptions webdriver.ChromeService webdriver.Ie webdriver.IeOptions webdriver.IeService webdriver.Edge webdriver.ChromiumEdge webdriver.EdgeOptions webdriver.EdgeService webdriver.Safari webdriver.SafariOptions webdriver.SafariService webdriver.WebKitGTK webdriver.WebKitGTKOptions webdriver.WebKitGTKService webdriver.WPEWebKit webdriver.WPEWebKitOptions webdriver.WPEWebKitService webdriver.Remote webdriver.DesiredCapabilities webdriver.ActionChains webdriver.Proxy webdriver.Keys
The special keys class (Keys
) can be imported like this:
from selenium.webdriver.common.keys import Keys
The exception classes can be imported like this (Replace the TheNameOfTheExceptionClass
with the actual class name given below):
from selenium.common.exceptions import [TheNameOfTheExceptionClass]
Conventions used in the API
Some attributes are callable (or methods) and others are non-callable (properties). All the callable attributes are ending with round brackets.
Here is an example for property:
current_url
URL of the currently loaded page.
Usage:
driver.current_url
Here is an example of a method:
close()
Closes the current window.
Usage:
driver.close()
.. automodule:: selenium.common.exceptions :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.common.action_chains :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.common.alert :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.common.keys :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
These are the attributes which can be used to locate elements. See the :ref:`locating-elements` chapter for example usages.
.. automodule:: selenium.webdriver.common.by :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
See the :ref:`selenium-remote-webdriver` section for example usages of desired capabilities.
.. automodule:: selenium.webdriver.common.desired_capabilities :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.common.proxy :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.common.utils :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.common.service :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.common.html5.application_cache :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.firefox.webdriver :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.firefox.options :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.firefox.firefox_profile :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.firefox.firefox_binary :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.firefox.extension_connection :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.chrome.webdriver :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.chrome.options :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.chrome.service :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.remote.webdriver :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.remote.webelement :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.remote.command :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.remote.errorhandler :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.remote.mobile :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.remote.remote_connection :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.remote.utils :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.ie.webdriver :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.safari.webdriver :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.safari.service :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.support.select :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.support.wait :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.support.color :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.support.event_firing_webdriver :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.support.abstract_event_listener :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance:
.. automodule:: selenium.webdriver.support.expected_conditions :members: :undoc-members: :special-members: __init__ :member-order: groupwise :show-inheritance: