So,
I collected all the anchors of a Page
in a list of HtmlAnchors
.
List<HtmlAnchor> downloadLinks = (List) loggedIn.getByXPath("//*[@id='ctl00_ContentPlaceHolder1_rgdProduction_ctl00']//a");
And then, I went in a loop to click on each anchor in the list and tried to fetch their respective Web Responses.
for (int i = 1; i < downloadLinks.size(); i++) {
Page p = (Page) downloadLinks.get(i).click();
WebResponse wr = p.getWebResponse();
System.out.println("Page Content: " + wr.getContentAsStream());
}
*NOTE: The anchors collected are of this format -> a href = "javascript:_some_methodname_()
The problem is that after clicking on each anchor in the list of Anchors, it fetches the same exact web response whereas it should have presented 'n' unique responses for 'n' anchors Similar question has been asked by other users, but I haven't found any solution to this problem.