• Public
  • Public/Protected
  • All

Interface AccessorApi

All methods of this interface are injected as global functions into Sakuli Scripts

It is inspired by Sahi Accessor API and aims the most possible compatibility to it.

The main difference is that all the functions returns SahiElementQueries instead of element references. This gives Sakuli the opportunity to fetch an element only when it is required (e.g. inside a _click action) or re-fetch it if becomes gets stale otherwise.













  • Fetches an element of TagName with clsName in it's classList attribute

    Based on CSS selector: tagName.clsName


    Assuming this HTML-snippet:

        <p class="leading class2">Lorem ipsum</p>

    Can be highlighted like this:

       // will highlight the paragraph above
       await _highlight(_byClassName('leading', 'p'));


    • clsName: string
    • tagName: string

    Returns SahiElementQueryOrWebElement


  • 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: string

      id of the element. Like document.getElementById(id)

    Returns SahiElementQueryOrWebElement






















































  • Fetches a radio field by an identifier - restricted by the relations

    Based on CSS selector: input[type="radio"]


    Assuming the following HTML-snippet:

    <h2>Prefered Drink?</h2>
        <input type="radio" name="drink" value="water" />
        <input type="radio" name="drink" value="wine" />
        <input type="radio" name="drink" value="beer" />

    Checking the field with _click:

    await _click(_radio(1)); // Selects 'Wine'


    Returns SahiElementQueryOrWebElement


























  • Fetches a text input field (or a without any type attribute because this is considered as text input by the browsers) by an identifier - restricted by the relations

    Based on CSS selector: input[type="text"], input:not([type])


    Assuming the following HTML-snippet:

       <input type="text" name="first-name" />
       <input name="last-name" />

    Setting the value of this fields:

       await _setValue(_textbox('first-name') ,"Bill")
       await _setValue(_textbox('last-name') ,"Jobs")


    Returns SahiElementQueryOrWebElement