This discussion is archived
1 Reply Latest reply: Nov 30, 2012 10:18 AM by DrClap RSS

HtmlUnit

655260 Newbie
Currently Being Moderated
Hello. I am creating my first HtmlUnit app. Here is what I have thus far:

-----

WebClient client = new WebClient();

HtmlPage page = client.getPage ("http://mydomain.com/welcome.jsp");

HtmlHiddenInput hidden = (HtmlHiddenInput) page.getElementByName("pagecodes");

System.out.println(hidden);

-----

The output displays the entire input line:

<input type=hidden name=pagecodes value=12345>

-----

How can I retrieve only the value of this hidden input?

Desired output: 12345

-----

Any suggestions are greatly appreciated.
  • 1. Re: HtmlUnit
    DrClap Expert
    Currently Being Moderated
    A quick look at the API documentation for the HtmlHiddenInput class shows that it has a "getValueAttribute" method whose description is
    Return the value of the attribute "value".

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points