Want to access attribute value

132 Views Asked by At

i need help regarding html parser i want to get the first attribute"href" value of tag "a" please resolve my problem.I want to fetch this link from the code http://myneta.info/gujarat2012/candidate.php?candidate_id=1591, i am attaching the snap please see and provide some solution, i have tried this code but not works for me -

String temp =  source.getElementById("main").getFirstElementByClass("grid_9").getAttributeValue("a");

here is image

1

There are 1 best solutions below

1
Guillermo Moscoso On

Please try the following:

source.getElementById("main").getFirstElementByClass("grid_9").getFirstElement("a").getAttributeValue("href")