How can I determine if a menu is collapsed

440 views
Skip to first unread message

kathyj

unread,
May 10, 2013, 2:01:08 PM5/10/13
to seleniu...@googlegroups.com
I have collapsible menus on a page and I want to be able to determine if they are collapsed or not.  I see the attribute in the code that tells whether or not it is collapsed, but I don't know how to write this in selenium and java. 

The code is as follows:

The id I'm using is topmenu_CruiseLines.  The attributes is data-collapsed="true" in the class.  Could someone steer me in the right direction?  Thanks,


<div id="topmenu_CruiseLines" class="ui-collapsible" data-inset="false" data-collapsed="true" data-iconpos="right" data-role="collapsible" name="Cruise Lines">
<h3 class="ui-btn-hover-c ui-collapsible-heading">
<a class="ui-collapsible-heading-toggle ui-btn ui-fullsize ui-btn-icon-right ui-focus ui-btn-hover-c" href="#" data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="span" data-icon="plus" data-iconpos="right" data-theme="c" data-mini="false">
<span class="ui-btn-inner">
<span class="ui-btn-text">
<span class="menu_collapsible">Cruise Lines</span>
<span class="ui-collapsible-heading-status"> click to collapse contents</span>
</span>
<span class="ui-icon ui-icon-shadow ui-icon-minus"/>
</span>
</a>

Jon Valvano

unread,
May 10, 2013, 2:06:23 PM5/10/13
to seleniu...@googlegroups.com
The data-collapsed is not a part of the class attribute.  It is its own attribute.

You can call element.getAttribute("data-collasped"); on the element that has the class "topmenu_CruiseLines".


P.S.  I would love if the code I was testing looked like this.  The developers are using some crazy styles to determine if our objects are collapsed or not.



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Y4sZTg_5H0UJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Vinothkumar Velusamy

unread,
May 10, 2013, 4:08:47 PM5/10/13
to seleniu...@googlegroups.com
Hi,

If there is only class attribute like "class="collapse", how can we sure that the data / menu items got collapsed. just by going with the name , we cannot make sure that the data got collapsed like the visual collapse,similar to that visual collapse, we need to check that the data which is to be verified after collapse should be hidden or something visible = 'false' should be tested. But i dont think so that developers are ready to give attributes like the one i mentioned for each and every element. Just by setting the CSS style way of hiding the element will work. I have come across similar kind of code from dev point of view and that is the reason for this email to u ..

Thanks 
Vinothkumar Velusamy
--
Best Regards,
Vinoth V
Cell:+91-9740-629-246

Reply all
Reply to author
Forward
0 new messages