Skip to content

Selenium commands

MirekVales edited this page Apr 14, 2018 · 6 revisions

Back

Navigates browser to a previous page (if any)

CaptureEntirePageScreenshot path

Takes a screenshot of the current page and writes it to a given path

Clear locator

Clears a value of located element(s)

Click locator

Performs a mouse click on located element(s)

ClickAt locator, offset

Performs a mouse click on located element(s) with a given offset

Count locator

Returns number of located elements

Deselect locator, optionLocator

Deselects option for a located element
Option may be located using index, label, or value
E.g. index=0

DoubleClick locator

Performs a double mouse click on located element(s)

Close

Closes current browser instance

DeleteAllCookies

Deletes all cookies from the current browser instance

DeleteCookieNamed name

Deletes all cookies that have a given name

Execute javascript

Executes a javascript in the current browser instance

Focus locator

Moves focus on located element

Forward

Navigates browser back to a next page (if any)

GetAttribute locator, attributeName

Returns a located element's attribute value

GetCookies

Returns all cookies of the current browser instance

GetCookieNamed name

Returns detail for a cookie with a given name

GetCssValue locator, propertyName

Returns a located element's css property value

GetCurrentUrl

Returns the current page's url

GetElementHeight locator

Returns a located element's height in pixels

GetElementSource locator

Returns a located element's source code

GetElementWidth locator

Returns a located element's width in pixels

GetPageSource

Returns the current page's source code

GetTagName locator

Returns a located element's tag name

GetText locator

Returns a text value of located element

GetTitle

Returns the current page's title

Highlight locator

Changes a located element's background color to yellow

IsDisplayed locator

Returns an indication whether the located element is visible

MouseDown locator

Pushes mouse button down on a located element

MouseDownAt locator, offset

Pushes mouse button down on a located element with a given offset

MouseUp locator

Releases mouse button down on a located element

MouseUpAt locator, offset

Releases mouse button down on a located element with a given offset

Open url

Navigates to a given url

Pause ms

Freezes processing for a given number of milliseconds

Refresh

Refreshes the current page

SavePageSource path

Saves the current page's source code to a file

Select locator, optionLocator

Selects option for a located element
Option may be located using index, label, or value
E.g. index=0

SetBrowser browser

Sets browser type

SetImplicitWait timeoutInMs

Sets a maximum amount of time the driver tries to locate an element before throwing an exception

SetPageLoadTimeout timeoutInMs

Sets a maximum amount of time the driver waits for a page to load

SetZoom zoomLevel

Sets zoom level

Submit locator

Submit a located element that is a form

Type locator, value

Sets a located element's value

TypeKeys locator, keys

Simulates keyboard presses on a located element

TypeKeysLikeHuman locator, keys

Simulates keyboard presses on a located element, random delays between each key press are generated

VerifyText locator, pattern

Throws an exception if a located element's text does not match a given pattern

WaitForCondition javascript, timeout

Waits for a given number of milliseconds or while a javascript script returns false

WindowFocus

Focuses a current browser window

WindowMaximize

Maximizes a current browser window