Javascript code which is executed in the browser
A variadic list of arguments that are passed to Javascript
Draws a red border around an element on the website.
This is useful for debugging and demonstrating reasons. Note that the timeout of this highlight will increase the actual execution time of the current step.
The element to be highlighted
determine how long the highlight will last (default: 2000
)
Navigates the browser instance to the given URL (also Data URLs are possible).
The URL of the Website to test - Could be any string that can be entered in a browser navigationbar
Forces the page to reload after it has been loaded - it is a relict of Sahi. Default: false
If a site requires "Http-Basic-Authentication" you can pass the credentials here
Continuously fetches the page source and checks for DOM changes. Will be repeated every $timeout milliseconds until either the DOM does no longer change or $timeout is reached
Maximum timout in ms to wait for DOM stabilization. Default: 2000 ms
Interval between stability checks in ms. Default: 200 ms
Wait for a maximum of the given timeout. It's also possible to pass an expression function which will be evaluated during the waiting.
Maximum amount of time to be waiting (in milliseconds)
An optional function which will abort the wait when it returns a truthy value
This function sends Javascript to the browser which is executed their. you can pass a list of arguments to this script.
The function is using ThenableWebdriver.executeScript internally.
All element queries in the
_args
list (e.g._div('Hello')
) are resolved to WebElements and are available as a HTMLElement in the scriptAll
_args
are available in thearguments
array in the script.the return value of the JavaScript is returned from this function.
const windowOuterHeight = await _eval(`return window.outerHeight`);
// Dispatch a custom Event from a button on the page const await _eval(` const btn = arguments[0]; btn.dispatchEvent(new CustomEvent('something-custom')); `, _button('Some special Button'))