I am trying to get a webelement's id and class if it has one. The first check using the id works fine, but the one checking the class doesn't. I don't know why but ' id ' returns true but ' class ' does not return anything. Any ideas on why this doesn't work and how to make it work?
var id = currentElement.id;
if(id)
{
targetDocument.write(" id=\""+currentElement.id+"\"");
}
var class = currentElement.className;
if(class)
{
targetDocument.write(" class=\""+currentElement.className+"\"");
}