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.
How can I read "onclick" attribute?
Hi!
Take a look at this:
The code above works and it outputs this in Sahi Log:
As you can see, the image was found and its "onclick" property is set.
However, when I run the code below:
The "if" condition evaluates to "false", and it logs "error"!
I think I don't know how to write the "if" statement properly. Could somebody, please, help me? The "if" must be true when the image is clickable, and "false" when the image doesn't have an "onclick" property set.
Regards,
André.
Take a look at this:
_log(_image(1, _near(_span("2.TP.21"))).onclick, "success");
The code above works and it outputs this in Sahi Log:
function onclick()
{
abrirMensaje(860,20132,125);
} at 07/06/2013 18:22:00
As you can see, the image was found and its "onclick" property is set.
However, when I run the code below:
if (_image(1, _near(_span("2.TP.21"))).onclick) {
_log("success", "success");
} else {
_log("error", "error");
}
The "if" condition evaluates to "false", and it logs "error"!
I think I don't know how to write the "if" statement properly. Could somebody, please, help me? The "if" must be true when the image is clickable, and "false" when the image doesn't have an "onclick" property set.
Regards,
André.
Answers