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.

Get all elements along with their respective Id's

AkshadaAkshada Members
edited November -1 in Sahi - Open Source
Hi All,

Can i get the elements present on a specific "Div"
Say for instance, On a div there are three trextboxes and one listbox.

Is there any way in JAVA to do this?

Regards
Akshada

Comments

  • Hi Akshada,

    Kindly have a look at this:

    http://sahi.co.in/forums/viewtopic.php?id=2714

    Regards
    Sumitra
  • AkshadaAkshada Members
    edited August 2011
    Hi Sumitra,

    In the post u mentioned i will get the count, whereas here, i want to get the elements or the Id's of the elements present.

    Thanks for your reply.

    Regards
    Akshada
  • sivasiva Members
    edited August 2011
    Hi Akshada,

    i hope this will help you to get all the elements present under specific area/ div

    _collect("_link", "/./", _in(_div("divID")));

    in this line i have used "_link" to get the link information, in the same way you have to mention the required object instead of link

    ******************************************************************************

    var $all_Links = _collect("_link", "/./", _in(_div("divID")));
    var $each_Link = [];

    for (var $i=0; $i<$all_Links.length; $i++) {
    _set($each_Link[$i], $all_Links[$i].id);
    }

    for (var $i=0; $i<$each_Link.length; $i++) {
    _alert($each_Link[$i]);
    }

    ******************************************************************************
Sign In or Register to comment.