18 January 2026:


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 to locate cells in two similar tables

ytchytch Members
edited November -1 in Sahi - Open Source
Hi,

I have a web page like this:
        Standard<br>
        <table id="row1" class="its">
            <tr><th>Version<th>Detail
            <tr><td>V1.1<td><a href="?v=V1.1&t=std">Detail</a>
            <tr><td>V1.0<td><a href="?v=V1.0&t=std">Detail</a>
        </table>
        Lite<br>
        <table id="row2" class="its">
            <tr><th>Version<th>Detail
            <tr><td>V1.1<td><a href="?v=V1.1&t=lite">Detail</a>
            <tr><td>V1.0<td><a href="?v=V1.0&t=lite">Detail</a>
        </table>
And I want to locate the "Detail" link for different Version and lite/standard
If I want to locate Standard V1.0, I can use:
_link("Detail", _near(_cell("V1.0")), _in(_table("row1")))

But I don't find any method to locate Lite V1.0
I've tried:
_link("Detail", _near(_cell("V1.0")), _in(_table("row2")))
_link("Detail", _near(_cell("V1.0")), _in(_byClassName("its[2]", "TABLE")))

and some others, but with no luck.
Can any help me to locate these cells? thanks

Comments

  • Hi ytch,

    The web page should be:
    Standard<br>
            <table id="row1" class="its">
                <tr><th>Version</th><th>Detail</th></tr>
                <tr><td>V1.1</td><td><a href="?v=V1.1&t=std">Detail</a></td></tr>
                <tr><td>V1.0</td><td><a href="?v=V1.0&t=std">Detail</a></td></tr>
            </table>
            Lite<br>
            <table id="row2" class="its">
                <tr><th>Version<th>Detail
                <tr><td>V1.1</td><td><a href="?v=V1.1&t=lite">Detail</a></td></tr>
                <tr><td>V1.0</td><td><a href="?v=V1.0&t=lite">Detail</a></td></tr>
            </table>
    

    To locate "Detail" for standard V1.0

    _link("Detail", _near(_cell("V1.0")), _in(_table("row1")))

    To locate "Detail" for Lite V1.0 :

    _link("Detail", _near(_cell("V1.0[1]")), _in(_table("row2")))

    Regards
    Sumitra
  • Hi,

    Thanks for your quick reply,
    It works.
This discussion has been closed.