Commands

The following is a list of the available WebDriver commands.

Close Window
The Close Window command of the WebDriver API closes the current top-level browsing context (window or tab) and returns with the list of currently open WebWindows. If it is the last window that is being closed, the WebDriver session will implicitly be deleted. Subsequent commands after the session is ended will therefore cause invalid session ID errors.
Get Element Attribute
The Get Element Attribute command of the WebDriver API returns the attribute of the referenced web element. If for example the element is an <img>, the returned attribute is "//TODO", which is equivalent to calling Element.getAttribute on the element. For XML/XHTML documents it may be cased differently.
Get Element Property
The Get Element Property command of the WebDriver API returns the property of the referenced web element. Given <input value=foo> where the user changes the value to bar, the returned property is bar rather than the initial value foo. This is equivalent to calling Element.getProperty on the element.
Get Element Tag Name
The Get Element Tag Name command of the WebDriver API returns the tag name of the referenced web element. If for example the element is an <img>, the returned tag name is "IMG", which is equivalent to calling Element.tagName on the element. For XML/XHTML documents it may be cased differently.
Get Timeouts
The Get Timeouts command of the WebDriver API returns the timeouts associated with the current session. The session timeout durations control such behaviour as timeouts on script injection, document navigation, and element retrieval.
Get Window Handles
The Get Window Handles command of the WebDriver API returns a list of all WebWindows. Each tab or window, depending on whether you are using a tabbed browser, is associated by a window handle that is used as a reference when switching to the window.
Get Window Rect
The Get Window Rect command of the WebDriver API returns the size and position of the given WebElement. Many WebDriver clients present separate API methods for getting an element’s location and dimensions, but as an optimisation they both use this primitive.
Set Timeouts
The Set Timeouts command of the WebDriver API sets the timeouts associated with the current session. The session timeout durations control such behaviour as timeouts on script injection, document navigation, and element retrieval.
Set Window Rect
The Set Window Rect command of the WebDriver API alters the size and position of the operating system window associated with the current window. The command acts as the setter of Get Window Rect, which return object you can pass directly as this command’s payload.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
AcceptAlert No1 No2557 No1 No3
AddCookie No1 No2557 No1 No3
Back No1 No2557 No1 No3
CloseWindow No1 No2557 No1 No3
DeleteAllCookies No1 No2557 No1 No3
DeleteCookie No1 No2557 No1 No3
DeleteSession No1 No2557 No1 No3
DismissAlert No1 No2557 No1 No3
ElementClear No1 No2557 No1 No3
ElementClick No1 No2557 No1 No3
ElementSendKeys No1 No2557 No1 No3
ExecuteAsyncScript No1 No2557 No1 No3
ExecuteScript No1 No2557 No1 No3
FindElement No1 No2557 No1 No3
FindElementFromElement No1 No2557 No1 No3
FindElements No1 No2557 No1 No3
FindElementsFromElement No1 No2557 No1 No3
Forward No1 No2557 No1 No3
FullscreenWindow No1 No2557 No1 No3
GetActiveElement No1 No2557 No1 No3
GetAlertText No1 No2557 No1 No3
GetAllCookies No1 No2557 No1 No3
GetCurrentURL No1 No2557 No1 No3
GetElementAttribute No1 No2557 No1 No3
GetElementCSSValue No1 No2557 No1 No3
GetElementProperty No1 No2557 No1 No3
GetElementRect No1 No2557 No1 No3
GetElementTagName No1 No2557 No1 No3
GetElementText No1 No2557 No1 No3
GetNamedCookie No1 No2557 No1 No3
GetPageSource No1 No2557 No1 No3
GetTimeouts No1 No2557 No1 No3
GetTitle No1 No2557 No1 No3
GetWindowHandle No1 No2557 No1 No3
GetWindowHandles No1 No2557 No1 No3
GetWindowRect No1 No2557 No1 No3
IsElementEnabled No1 No2557 No1 No3
IsElementSelected No1 No2557 No1 No3
MaximizeWindow No1 No2557 No1 No3
MinimizeWindow No1 No2557 No1 No3
NavigateTo No1 No2557 No1 No3
NewSession No1 No2557 No1 No3
PerformActions No1 No2557 No1 No3
Refresh No1 No2557 No1 No3
ReleaseActions No1 No2557 No1 No3
SendAlertText No1 No2557 No1 No3
SetTimeouts No1 No2557 No1 No3
SetWindowRect No1 No2557 No1 No3
Status No1 No2557 No1 No3
SwitchToFrame No1 No2557 No1 No3
SwitchToParentFrame No1 No2557 No1 No3
SwitchToWindow No1 No2557 No1 No3
TakeElementScreenshot No1 No2557 No1 No3
TakeScreenshot No1 No2557 No1 No3
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
AcceptAlert No1 No1 No2 No No1 No3 No4
AddCookie No1 No1 No2 No No1 No3 No4
Back No1 No1 No2 No No1 No3 No4
CloseWindow No1 No1 No2 No No1 No3 No4
DeleteAllCookies No1 No1 No2 No No1 No3 No4
DeleteCookie No1 No1 No2 No No1 No3 No4
DeleteSession No1 No1 No2 No No1 No3 No4
DismissAlert No1 No1 No2 No No1 No3 No4
ElementClear No1 No1 No2 No No1 No3 No4
ElementClick No1 No1 No2 No No1 No3 No4
ElementSendKeys No1 No1 No2 No No1 No3 No4
ExecuteAsyncScript No1 No1 No2 No No1 No3 No4
ExecuteScript No1 No1 No2 No No1 No3 No4
FindElement No1 No1 No2 No No1 No3 No4
FindElementFromElement No1 No1 No2 No No1 No3 No4
FindElements No1 No1 No2 No No1 No3 No4
FindElementsFromElement No1 No1 No2 No No1 No3 No4
Forward No1 No1 No2 No No1 No3 No4
FullscreenWindow No1 No1 No2 No No1 No3 No4
GetActiveElement No1 No1 No2 No No1 No3 No4
GetAlertText No1 No1 No2 No No1 No3 No4
GetAllCookies No1 No1 No2 No No1 No3 No4
GetCurrentURL No1 No1 No2 No No1 No3 No4
GetElementAttribute No1 No1 No2 No No1 No3 No4
GetElementCSSValue No1 No1 No2 No No1 No3 No4
GetElementProperty No1 No1 No2 No No1 No3 No4
GetElementRect No1 No1 No2 No No1 No3 No4
GetElementTagName No1 No1 No2 No No1 No3 No4
GetElementText No1 No1 No2 No No1 No3 No4
GetNamedCookie No1 No1 No2 No No1 No3 No4
GetPageSource No1 No1 No2 No No1 No3 No4
GetTimeouts No1 No1 No2 No No1 No3 No4
GetTitle No1 No1 No2 No No1 No3 No4
GetWindowHandle No1 No1 No2 No No1 No3 No4
GetWindowHandles No1 No1 No2 No No1 No3 No4
GetWindowRect No1 No1 No2 No No1 No3 No4
IsElementEnabled No1 No1 No2 No No1 No3 No4
IsElementSelected No1 No1 No2 No No1 No3 No4
MaximizeWindow No1 No1 No2 No No1 No3 No4
MinimizeWindow No1 No1 No2 No No1 No3 No4
NavigateTo No1 No1 No2 No No1 No3 No4
NewSession No1 No1 No2 No No1 No3 No4
PerformActions No1 No1 No2 No No1 No3 No4
Refresh No1 No1 No2 No No1 No3 No4
ReleaseActions No1 No1 No2 No No1 No3 No4
SendAlertText No1 No1 No2 No No1 No3 No4
SetTimeouts No1 No1 No2 No No1 No3 No4
SetWindowRect No1 No1 No2 No No1 No3 No4
Status No1 No1 No2 No No1 No3 No4
SwitchToFrame No1 No1 No2 No No1 No3 No4
SwitchToParentFrame No1 No1 No2 No No1 No3 No4
SwitchToWindow No1 No1 No2 No No1 No3 No4
TakeElementScreenshot No1 No1 No2 No No1 No3 No4
TakeScreenshot No1 No1 No2 No No1 No3 No4

1. To enable Chromium support, include {"goog:chromeOptions": {"w3c": true}} in the capabiliites when running the command.

2. The vendor-supported implementation for Edge is non-spec-conforming and incompatible.

3. The vendor-supported implementation for Safari is non spec-conforming and incompatible.

4. The vendor-supported implementation for Samsung Internet is non-spec-conforming and incompatible.

Document Tags and Contributors

Contributors to this page: ExE-Boss, chrisdavidmills
Last updated by: ExE-Boss,