Need to get a value of an attribute using selenium

I was in this situation when i needed to get the value of an html attribute and i found the selenium.getattribute very handy …..

Okay the scenario was such that there was an element which is collapsible on the page and the only attibute for that element that indictated the status of the collapsible element was the ‘Class’. when the element was collapsed, the value of the class attribute was ‘asleep’ and when the element was expanded, the value of the class atttribute was ‘awake’.

The script used to determine the status of this element is

selenium.GetAttribute("elementLocator@nameofAttribute");<br /><br />so if the id of my element is FundingClass and the attribute we are interested in is the 'Class'<br /><br />The selenium code will be<br />selenium.GetAttribute("FundingClass@Class");<br /><br />Hope this helps someone .....<br />
You Might Also Like
Comments
comments powered by Disqus