I have been playing with this code for a while, and I am not certain what I am doing wrong.
I get a url, clean it up with JTidy, as it isn't well-formed, then I need to find a particular hidden input field (input
type="hidden" name="mytarget" value="313"
), so I know the value in the name attribute.
I have it printing out the entire html page when it cleans it up, just so I can compare what I am looking for with what is in the document.
My problem is trying to determine the best way to find this, about where I have System.out << it
.
def http = new HTTPBuilder( url )
http.request(GET,TEXT) { req ->
response.success = { resp, reader ->
assert resp.status == 200
def tidy = new Tidy()
def node = tidy.parse(reader, System.out)
def doc = tidy.parseDOM(reader, null).documentElement
def nodes = node.last.last
nodes.each{System.out << it}
}
response.failure = { resp -> println resp.statusLine }
}