I am having trouble clicking on a link inside htmlunit. I went through the api on the site (which I really didn’t understand very well) and looked at the whole sample code that I could find, and I still have a problem with clicking on the links.
Here's the top of the messsage error (its pretty big, if you want, I can send it all)
"page2 = link2.click() Exception class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException] com.gargoylesoftware.htmlunit.ScriptException: Sys.ArgumentOutOfRangeException: Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: x Actual value was Infinity. "
The first page loads fine, but when I click on the second link, I get this error (javascript link). Here is part of my code
page = webclient.getPage(url)
anchors1 = page.getAnchors()
for anchor in anchors1:
if anchor.asText() == "2":
link2 = anchor
break
page2 = link2.click()
If I make a link to print2, I get: HtmlAnchor[<a href="javascript:__doPostBack('ctl00$MainContent$gvSearchResults','Page$2')">]
At first I thought that maybe the problem with HtmlAnchor was a problem, and I had to remove it, but then I looked at another code example and they seem to have their links in the same format and work.
So confused .. please help :-)
Thanks in advance!