Skip to content

Selenium REPL Exclusive Functions

Jeremy Ryan Chandler edited this page Nov 20, 2021 · 8 revisions

buildDriver()

Start a new chrome webdriver and assign driver to it. Builds with the standard options every time and returns the driver.

get(url)

Navigate to a given url with the current webdriver or spins up a new one if driver is null or undefined. Prepends HTTPS:// if the scheme is left off.

importSelectors()

Adds the following functions to the REPL:

$(selector, [startNode])

Returns the reference to the first DOM element with the specified CSS selector. This function also supports a second parameter, startNode, that specifies an 'element' or Node from which to search for the element. The default value of this parameter is document.

$$(selector, [startNode])

Returns a list of DOM element references with the specified CSS selector. This function also supports a second parameter, startNode, that specifies an 'element' or Node from which to search for elements. The default value of this parameter is document.

$x(selector, [startNode])

Returns the reference to the first DOM element with the specified xpath selector. This function also supports a second parameter, startNode, that specifies an 'element' or Node from which to search for the element. The default value of this parameter is document.

$$x(selector, [startNode])

Returns a list of DOM element references with the specified xpath selector. This function also supports a second parameter, startNode, that specifies an 'element' or Node from which to search for the elements. The default value of this parameter is document.