The current TestExecutionContext provided by Sakuli runtime this is usually not needed in a Testcase.
Instance of ThenableWebDriver. Can execute any native method of webdriver. It's not recommended to use it in a testcase.
Fetches a area element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: area
Creates a relation that identifies relational elements by the following criteria:
Create a query that resolves to the element which is currently focused
CSS: :focus
Checks if two queries resolves to the same element.
Fetches a area element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: area
Fetches a article element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: article
Fetches a aside element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: aside
Throws an AssertionError
when condition
resolves to false
If the exception from this assertion is not handled, Sakuli will print and log this message.
Throws an AssertionError
when element
doesn't contains text
.
Uses {@link FetchApi._containsText}
Throws an AssertionError
when expected
value doesn't deep strictly equals
the actual
value.
Basically the same as {@link AssertionApi._assertEqual} but only excepts arrays as èxpected
and actual
values.
Throws an AssertionError
when element
doesn't exists in the current dom.
Uses {@link FetchApi._exists}
Opposite of {@link AssertionApi._assertTrue}.
It throws an AssertionError
when condition
resolves to true
Throws an AssertionError
when element
contains text
.
Uses {@link FetchApi._containsText}
Throws an AssertionError
when expected
value deep strictly equals
the actual
value.
Throws an AssertionError
when element
exists in the current dom.
Uses {@link FetchApi._exists}
Throws an AssertionError
when value
is null
.
Note that this method uses deep strict equality
so that an undefined
value will also pass the assertion.
Alias for {@link AssertionApi._assertFalse}
If the exception from this assertion is not handled, Sakuli will print and log this message.
Throws an AssertionError
when value
is not null
.
Note that this method uses deep strict equality
so that an undefined
value will also fail the assertion.
Alias for {@link AssertionApi._assert}
If the exception from this assertion is not handled, Sakuli will print and log this message.
Fetches a blockqoute element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: blockqoute
Fetches an element and performs the native .blur()
in the browser.
That means that this element will lose the focus-state.
Resolves when browser-script finished
Fetches a bold element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: b
Fetches a button by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: button
Fetches an element of TagName
with clsName
in it's classList
attribute
Based on CSS selector: tagName.clsName
Fetches an element by it's id
attribute.
If the id
of an element i known and somehow stable in the dom (not generated by an CMS for example) this is the recommended way to query an element because it is the fastest.
id of the element. Like document.getElementById(id)
Fetches an element of tagName
with the given text
Fetches an element by a xPath-expression on the current webpage.
Fetches a canvas element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: canvas
Fetches a table-data element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: td
Performs a click on a checkbox input and forces its state to be checked
Fetches a checkbox field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="checkbox"]
_click simulates a user's click on the given element.
query to the Element to click on
Optional combo key(s): can be CTRL, SHIFT, ALT or META;
Can also be two or more keys together like "CTRL|SHIFT"
disables validations prior to the click action to enforce clicks where an element e.g. is covered
Resolves after the click is invoked, doesn't wait for further actions on the website which are possibly invoked after the click
Fetches a code element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: code
Collects all specified elements
Check if a parent element contains a child element.
Compares the .innerHTML
of an element with the given html string.
Both .innerHTML
and the snippet are unified using the html
function from common-tags library.
Checks if the displayed text of the element contains the given text. The text parameter is turned into an RegExp object before performing the check.
Counts all specified elements
Fetches a definition-description element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: dd
Fetches a definition-list element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: dl
Fetches a definition-term element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: dt
Fetches a date field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="date"]
If you want to set a value on this element please consider the supported formats
Fetches a datetime field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="datetime"]
If you want to set a value on this element please consider the supported formats
Fetches a datetime-local field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="datetime-local"]
If you want to set a value on this element please consider the supported formats
Fetches a details element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: details
Fetches a div element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: div
Performs a mouse down on eSource, than moves the mouse to the position of element eTarget and releases the mouse button at this position.
This implementation uses Webdriver actions which does not always behave as expected.
For a more reliable experience ThenableRegion.dragAndDropTo is recommended.
Performs a mouse down on eSource, than moves the mouse to the position P(x,y) in the browsers' viewport and releases the mouse button at this position.
This implementation uses Webdriver actions which does not always behave as expected.
For a more reliable experience ThenableRegion.dragAndDropTo is recommended.
A relic from Sakuli v1, that was used load
Fetches a email field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="email"]
Fetches a embed element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: embed
Fetches an emphasis element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: em
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 script
All _args
are available in the arguments
array in the script.
the return value of the JavaScript is returned from this function.
Javascript code which is executed in the browser
A variadic list of arguments that are passed to Javascript
Resolves to true
/ false
when the element can be found in the DOM or not.
Executes the given query and returns a "native" WebElement
instance
when the query is successful.
Fetches a fieldset element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: fieldset
Fetches a figcaption element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: figcaption
Fetches a figure element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: figure
Fetches a file input by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="file"]
Fetches an element and performs the native .focus()
method in the browser.
When _focus
is performed on an <input>
element, it will be automatically scrolled into the viewport by the browser.
Note that not all elements will get an actual focus in the browser.
Usually links and user-controls (e.g. <input>
, <textarea>
, <select>
...) can gain focus.
Query or concrete WebElement
Resolves when browser-script finished
Fetches a font element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: font
Fetches a footer element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: footer
Fetches a frame element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: frame
Retrieves the value of an element attribute.
Alias for {@link FetchApi._getText}.
Gets the maximum time Sakuli will try to find an element on dom.
Finds all option
elements within the queried element and resolves to an array with all visible texts of the options.
If the parameter value
is set to "value"
it will resolve to an array with all option values.
Retrieves the text content of the selected option
within the select
element.
Retrieves the selection from a user in the current document as a string
.
This is most likely the text what will set to the clipboard if a user
copies the selection.
Gets the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace. It uses WebElement.getText()
method internally.
Retrieves the actual value from the value attribute of an [Element or Query]{@link SahiElementQueryOrWebElement}.
Fetches a header element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: header
Fetches a heading element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: h1
Fetches a heading element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: h2
Fetches a heading element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: h3
Fetches a heading element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: h4
Fetches a heading element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: h5
Fetches a heading element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: h6
Fetches a hidden field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="hidden"]
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
)
Fetches a horizontal-ruler element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: hr
Fetches a iframe element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: iframe
Fetches an image by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: img
Fetches a image button by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="image"]
Creates a relation that specifies elements inside the anchor element.
Checks if the element has an attribute checked
. This is useful for checkboxes or radio inputs.
Checks if an element is enabled. An element is considered as enabled when it has no disabled
attribute set.
Tests if this element is currently displayed. Using a timeout of maximum one second. If a longer timeout is needed, {@link ActionApi._wait} can be used. It uses WebElement.isDisplayed internally.
Fetches a italic element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: i
Invokes a single keydown
event on the given element.
This is useful if you want to invoke a certain event which relies
on the keydown event. In most cases it has to be used together with {@link KeyboardActionsApi._keyUp}
Optional combo key(s): can be CTRL, SHIFT, ALT or META;
Can also be two or more keys together like "CTRL|SHIFT"
Performs a single keystroke ('keypress'
-event) on the element.
Optional combo key(s): can be CTRL, SHIFT, ALT or META;
Can also be two or more keys together like "CTRL|SHIFT"
Invokes a single keyup
event with the given element.
This is only useful when {@link KeyboardActionsApi._keyDown} is invoked previously. Some WebDrivers like Firefox will not trigger any event if there was no keypress before.
Fetches a label element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: label
Creates a relation that identifies relational elements by the following criteria:
+----+
| 1 |
+----+ ~~~~~~~~~ +----+
+----+ ~ | 3 |
| 2 | +----+
+----+
In this case element 1
and element 2
are "left of" element 3
, but element 1
is not "left of" element 2
as they do not align horizontally.
Creates a relation that identifies relational elements by the following criteria:
+----+
| 1 |
+----+ ~~~~~~~~~ +----+
| 3 | ~ +----+
+----+ | 2 |
+----+ +----+
| 4 |
+----+
In this case element 1
and element 2
are "left or right of" element 3
, but element 4
is not "left or right of" element 3
as they do not align horizontally.
Fetches a anchor / link element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: a
Fetches an unordered list element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: ul
Fetches a list-item element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: li
Fetches a main element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: main
Fetches a map element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: map
Fetches a mark element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: mark
Fetches a month field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="month"]
If you want to set a value on this element please consider the supported formats
Performs a press
action on the element
Indicates that the right mousebutton is pressed
Any combo key: can be "CTRL", "SHIFT", "ALT" or "META"; Can also be two or more keys together like "CTRL|SHIFT"
Invokes a mouse over on the queried element. Can be combined with a key combo.
Optional combo key(s): can be CTRL, SHIFT, ALT or META;
Can also be two or more keys together like "CTRL|SHIFT"
Performs a release
action on the element.
Release is the action when a user releases his finger from the mouse button.
Indicates that the right mousebutton is released
Optional combo key(s): can be CTRL, SHIFT, ALT or META;
Can also be two or more keys together like "CTRL|SHIFT"
Fetches a nav element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: nav
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
Creates a relation which returns the given element nearest (distance within the DOM tree) to the anchor
Fetches a number field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="number"]
If you want to set a value on this element please consider the supported formats
Fetches a object element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: object
Fetches an option element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: select
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
Fetches a paragraph element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: p
Fetches the HTML-table-cell (with tag td
), if the element specified by q
is its child.
If occurrence
is set to n
, the n-th parent table-cell out of the hierarchy of given elements parents, will be returned.
occurrence
defaults to 1, which is the immediate parent.
Fetches an element with tagName
that encloses the anchor element q
.
If occurrence
is set to n
, the n-th parent of the given element will be returned.
occurrence
defaults to 1, which is the immediate parent.
Fetches the HTML-table-row if it is a parent of the element specified by q
.
If occurrence
is set to n
, the n-th parent table-row out of the hierarchy of given elements parents, will be returned.
occurrence
defaults to 1, which is the immediate parent.
Fetches the HTML-table if it is a parent of the element specified by q
.
If occurrence
is set to n
, the n-th parent table out of the hierarchy of given elements parents, will be returned.
occurrence
defaults to 1, which is the immediate parent.
Fetches a password field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="password"]
Returns a tuple describing an element's location, in pixels relative to the document element.
Fetches a preformat element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: pre
Fetches a radio field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="radio"]
Fetches a range field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="range"]
Fetches a reset button by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="reset"]
Performs a right click on the queried element. Can be combined with a key combo.
Any combo key: can be "CTRL", "SHIFT", "ALT" or "META"; Can also be two or more keys together like "CTRL|SHIFT"
Creates a relation that identifies relational elements by the following criteria:
+----+
| 1 |
+----+ ~~~~~~~~~ +----+
+----+ ~ | 3 |
| 2 | +----+
+----+
In this case element 3
is "right of" element 1
and element 2
, but element 2
is not "right of" element 1
as they do not align horizontally.
Fetches a table-row element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: tr
Fetches a iframe element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: iframe
Fetches a search field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="search"]
Fetches a section element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: section
Fetches a select element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: select
Sets the maximum time Sakuli will try to find an element on dom.
Timeout in milliseconds
Sets the options within a <select>
element.
Selection can be done by the actual values of an option or its zero-based element index.
This action will invoke a click on the option element which means that the selected state is not enforced. If an option is already selected, it will be unselected.
Sets a value on an <input />
field.
It will clear the existing value from the input before:
It will send each character from the value string to the input with an delay of 10 ms
using .sendKeys.
This ensures that components which rely on key-events (like keyup
or keydown
) will behave
as expected on the page.
When .sendKeys fails,
_setValue
will try to set the value attribute of the dom element.
Fetches a span element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: span
Fetches a strong element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: strong
Styles in HTML elements are calculated by the browser based on various CSS rules.
_style
returns the computed style that is finally applicable to the element.
If the element inherits the named style from
its parent, the parent will be queried for its value. Where possible,
color values will be converted to their hex representation (e.g. #00ff00
instead of rgb(0, 255, 0)
).
Accessing the style directly as an attribute will not return a computed style.
Always use _style
instead.
Warning: A proper assertion will be difficult as some browser may interpret it differently.
Fetches a submit button by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="submit"], button[type="submit"]
Fetches a summary element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: summary
Fetches a circle element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: circle
Fetches a ellipse element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: ellipse
Fetches a line element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: line
Fetches a path element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: path
Fetches a polygon element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: polygon
Fetches a polyline element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: polyline
Fetches a rect element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: rect
Fetches a text element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: text
Fetches a text-span element (from a svg-image) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: tspan
Fetches a table element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: table
Fetches a table-header element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: th
Fetches a tel field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="number"]
Fetches a textarea by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: textarea
Fetches a text input field (or a without any type attribute because this is considered as text input by the browsers) by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="text"], input:not([type])
Fetches a time element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: time
Fetches a number field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="time"]
Retrieves the current text content of the documents title
element.
Invokes .sendKeys on the given element.
It will neither type with a delay nor set the value
-attribute when the method fails.
Performs a click on a checkbox input and forces its state not to be checked
Creates a relation that identifies relational elements by the following criteria:
Creates a relation that identifies relational elements by the following criteria:
Fetches a url field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="url"]
Fetches a video element by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: video
Wait for a maximum of the given timeout. It's also possible to pass an expression function which will be evaluated during the waiting. The truthy evaluated value of the expression will be returned from _wait.
Fetches a week field by an [identifier]{@link AccessorIdentifier} - restricted by the [relations]{@link RelationApi}
Based on CSS selector: input[type="week"]
If you want to set a value on this element please consider the supported formats
A relic from Sahi, just defined to ensure backward compatibility