Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

Index

Methods

_abbr

_activeElement

_area

_article

_aside

_blockquote

_bold

_button

_byClassName

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

    Based on CSS selector: tagName.clsName

    example


    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'));
    

    Parameters

    • clsName: string
    • tagName: string

    Returns SahiElementQueryOrWebElement

_byId

  • 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.

    Parameters

    • id: string

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

    Returns SahiElementQueryOrWebElement

_byText

_byXPath

_canvas

_cell

_checkbox

_code

_dDesc

_dList

_dTerm

_datebox

_datetimebox

_datetimelocalbox

_details

_div

_emailbox

_embed

_emphasis

_fieldset

_figcaption

_figure

_file

_font

_footer

_frame

_header

_heading1

_heading2

_heading3

_heading4

_heading5

_heading6

_hidden

_hr

_iframe

_image

_imageSubmitButton

_italic

_label

_link

_list

_listItem

_main

_map

_mark

_monthbox

_nav

_numberbox

_object

_option

_paragraph

_password

_preformatted

_radio

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

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

    example

    Assuming the following HTML-snippet:

    <h2>Prefered Drink?</h2>
    <label>
        <span>Water</span>
        <input type="radio" name="drink" value="water" />
    </label>
    <label>
        <span>Wine</span>
        <input type="radio" name="drink" value="wine" />
    </label>
    <label>
        <span>Beer</span>
        <input type="radio" name="drink" value="beer" />
    </label>

    Checking the field with _click:

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

    Parameters

    Returns SahiElementQueryOrWebElement

_rangebox

_reset

_row

_rte

_searchbox

_section

_select

_span

_strong

_submit

_summary

_svg_circle

_svg_ellipse

_svg_line

_svg_path

_svg_polygon

_svg_polyline

_svg_rect

_svg_text

_svg_tspan

_table

_tableHeader

_telephonebox

_textarea

_textbox

  • 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])

    example

    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")

    Parameters

    Returns SahiElementQueryOrWebElement

_time

_timebox

_urlbox

_video

_weekbox