WebDriver commands
The following is a list of the available WebDriver commands.
- Close Window
TheClose Windowcommand of theWebDriver API closes the current top-level browsing context (window or tab) and returns with the list of currently open
WebWindow
s. 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 causeinvalid session ID errors.- Get Element Attribute
TheGet Element Attributecommand of theWebDriver API returns the attribute of the referencedweb element. If for example the element is an
img
, the returned attribute is"//TODO"
, which is equivalent to callingElement.getAttribute
on the element. For XML/XHTML documents it may be cased differently.- Get Element Property
TheGet Element Propertycommand of theWebDriver API returns the property of the referencedweb element. Given
<input value=foo>
where the user changes the value tobar
, the returned property isbar
rather than the initial valuefoo
. This is equivalent to accessing the property on the element.- Get Element Tag Name
TheGet Element Tag Namecommand of theWebDriver API returns the tag name of the referencedweb element. If for example the element is an
img
, the returned tag name is"IMG"
, which is equivalent to callingElement.tagName
on the element. For XML/XHTML documents it may be cased differently.- Get Timeouts
TheGet Timeoutscommand of theWebDriver API returns the timeouts associated with the current session. Thesession timeout durations control such behavior as timeouts onscript injection,document navigation, andelement retrieval.
- Get Window Handles
TheGet Window Handlescommand of theWebDriver API returns a list of all
WebWindow
s. Each tab or window, depending on whether you are using a tabbed browser, is associated by awindow handle that is used as a reference whenswitching to the window.- Get Window Rect
TheGet Window Rectcommand of theWebDriver API returns the size and position of the given
WebElement
. ManyWebDriver clients present separate API methods for getting an element's location and dimensions, but as an optimization they both use this primitive.- New Window
TheNew Windowcommand of theWebDriver API opens a new top-level browsing context of typewindow ortab, and returns with a dictionary containing thehandle of the newWebWindow and its createdtype. If the requestedtype cannot be created by the browser, the alternative type will be tried to create.
- Set Timeouts
TheSet Timeoutscommand of theWebDriver API sets the timeouts associated with the current session. Thesession timeout durations control such behavior as timeouts onscript injection,document navigation, andelement retrieval.
- Set Window Rect
TheSet Window Rectcommand of theWebDriver API alters the size and position of the operating system window associated with the current
window
. The command acts as the setter ofGet Window Rect, which return object you can pass directly as this command's payload.
In this article
Browser compatibility
Loading…