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.
Accessing Child Elements
Hi,
i have a html like below
<div id="menu">
<ul>
<li id="open" enabled="false">
<a href="#">Open...</a>
</li>
</ul>
</div>
<div id="menu1">
<ul>
<li id="open" enabled="false">
<a href="#">Open...</a>
</li>
</ul>
</div>
now i want know the list item open is enabled or not in 'Menu div' ( Not in Menu1 div )
i can check like this if it is only one unique id _listItem("novadrive-mnu-accesssettings").getAttribute("enabled")
but its not, so i need to check with related parent element, so is there any option to get like below
_alert(_div("menu").listItem("Open").getAttribute("enabled"));
please help me.
Thanks and Regards,
Priya.
i have a html like below
<div id="menu">
<ul>
<li id="open" enabled="false">
<a href="#">Open...</a>
</li>
</ul>
</div>
<div id="menu1">
<ul>
<li id="open" enabled="false">
<a href="#">Open...</a>
</li>
</ul>
</div>
now i want know the list item open is enabled or not in 'Menu div' ( Not in Menu1 div )
i can check like this if it is only one unique id _listItem("novadrive-mnu-accesssettings").getAttribute("enabled")
but its not, so i need to check with related parent element, so is there any option to get like below
_alert(_div("menu").listItem("Open").getAttribute("enabled"));
please help me.
Thanks and Regards,
Priya.
Tagged:
This discussion has been closed.
Comments
In your case, use:
_alert(_listItem("Open", _in(_div("menu"))).getAttribute("enabled"));
Regards,
Narayan
example:
<li id='open' enabled='true'>open</li> -> here working fine
<li id='open'>open</li>
$('#open').attr('enabled', 'true');
in this case its not working.
Btw, it is better to assert properties which are visible to the user. Checking for a property which is code specific may not be a real functional test.