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");

so if the id of my element is FundingClass and the attribute we are interested in is the 'Class'

The selenium code will be
selenium.GetAttribute("FundingClass@Class");

Hope this helps someone .....
Advertisements
This entry was posted in Software Testing and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s