In this example I will tell you how you can use selenium command getAttribute in Selenium 2 Webdriver. I had to use this as selenium.getAttribute was not working on Webdriver when I was using HtmlUnitDriver. It was working when I was using FirefoxDriver. I had to convert the selenium.getAttribute to make it work on both HtmlUnitDriver and FirefoxDriver.
Here is the HTML code I that I want to check:
The code for getAttribute in Selenium RC is as under:
The same code for getAttribute in HtmlUnitDriver and FirefoxDriver is as under: