18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Sahi identifier question
Hi, I have to evaluate Selenium for automation but I came across Sahi which seems also interesting
However, I don't understand how to solve the following problem. In the documentation I see
API _button(identifier[, domRelation])
HTML <input type="button" name="name" id="id" value="value">
HTML <button type="button" name="name" id="id">value</button>
Identifier index, value, name, id
There seems to be no way to explicitly define the type of identifier. Suppose a button with id="button1" is by mistake replaced with a button with value="button1". A Sahi script looking for _button("button1") will not detect this and keep on working even though there is an error on the page. With Selenium you can explicitly look for a button with the id="button1".
However, I don't understand how to solve the following problem. In the documentation I see
API _button(identifier[, domRelation])
HTML <input type="button" name="name" id="id" value="value">
HTML <button type="button" name="name" id="id">value</button>
Identifier index, value, name, id
There seems to be no way to explicitly define the type of identifier. Suppose a button with id="button1" is by mistake replaced with a button with value="button1". A Sahi script looking for _button("button1") will not detect this and keep on working even though there is an error on the page. With Selenium you can explicitly look for a button with the id="button1".
Comments
Given that Sahi is a functional testing tool, Sahi tries to keep the details of the HTML page away from testers. We have seen that depending on explicit attributes for identification makes the tests more brittle, and more work for maintenance. If what you want is an assertion on the value of the button, you could add it explicitly using
_assertEqual("button1", _button("button1").value);
Once you start working on your scripts, you will realize how much easier it is to work with Sahi's APIs.
Does anyone else on the forums have any views on this?
Regards,
Narayan
Hi,
The API documentation that Candela has mentioned is from
Regarding your question on domRelation, as the link says,
Sahi can identify elements with respect to other elements on the page using _near, _under, _in etc. This is what is meant by domRelation (relation according to the DOM structure).
Regards.