Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

Generic Accessor APIs

Since
Sahi Pro 4.0

Modes Browser

_activeElement()

Arguments

NameTypeDescription
None

Returns

HTML DOM elementElement in focus

Used to verify if the specific element is the one in focus. Eg

_assertEqual(_texbox("user"), _activeElement());
Since
Sahi Pro 3.5

Modes Browser

_byId($id)

Arguments

NameTypeDescription
$idstringid of element

Returns

HTML DOM elementElement matching with the specified id

Used to find elements solely by id without using its tagName information.

<div id="errormsg">Error</div>
_byId("errormsg") // points to the above tag. Note that the tagName "div" is not used here.
Since
Sahi Pro 3.5

Modes Browser

_byText($text, $tagName)

Arguments

NameTypeDescription
$textstringtext of element
$tagNamestringtagName of element which has this text. eg. "DIV"

Returns

HTML DOM elementElement matching with the specified text and tagName

Used to find element by text and tagName

<div id="errormsg">some text</div>
_byText("some text", "DIV") // points to the above tag.
Since
Sahi Pro 3.5

Modes Browser

_byClassName($className, $tagName[, $relations])

Arguments

NameTypeDescription
$classNamestringclassName of element
$tagNamestringtagName of element which has this text. eg. "DIV"
$relationsrelationoptionalDOM or Positional Relations

Returns

HTML DOM elementElement matching with the specified className and tagName

Finds element by className with given tagName and constrained by given relations

<div class="bigfont">Some text</div>
_byClassName("bigfont", "DIV")
Since
Sahi Pro 3.5

Modes Browser

_byXPath($xpath)

Arguments

NameTypeDescription
$xpathstringXPath of element

Returns

HTML DOM elementElement matching with the specified xpath

Eg.

_byXPath("//table[3]//tr[1]/td[2]")
_byXPath("//tr[1]/td[2]")

This is a convenience method for people moving from Selenium or other tools to Sahi.

Since
Sahi Pro 3.5

Modes Browser

_accessor($string)

Arguments

NameTypeDescription
$stringstringString to eval

Returns

HTML DOM elementElement

This API just evaluates the string and returns a dom object. Eg. _accessor("document.formName.elementName"). This API is not very useful.

Since
Sahi Pro 3.5

Modes Browser

_bySeleniumLocator($locator)

Arguments

NameTypeDescription
$locatorstringselenium locator

Returns

null

Allows identification of elements using some Selenium locators. Use only while migrating from Selenium to Sahi.