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.
Dynamic link within a table
I'm still relatively new to Sahi. I have a table with a header row and data row. In row 2 (data) and column 2, I have a dynamic link. I need to capture the innerHTML link text and use that to click on the link. I have tried a few gyrations of _getText. My latest is:
var $ref = _getText(_link(0, _in(row(1))), _under(_cell("Ref")).innerHTML;
Ideas?
var $ref = _getText(_link(0, _in(row(1))), _under(_cell("Ref")).innerHTML;
Ideas?
This discussion has been closed.
Comments
To identify a link, you do not necessarily need to get its text. Just _link(0, <relation>) should give you the link. You can directly pass it to _click.
_getText already gets the innerHTML, and gets the text in such a way that it works across browsers. So you do not need to use both innerHTML and _getText
In your case, first try to get to the cell where the link is located.
Copy this to your "evaluate expression" box and click on "Highlight" to see if it points to the right element.
_link(0, _in(_row(1)), _under(_cell("Ref")))
If that does not seem to work, CTRL-Hover over the cell containing the link, and then expand the "Alternatives" dropdown to see what options are available. One of the options should show the index of the row containing that cell. Use that instead of _row(1)
Hope that helps.
Regards,
Narayan