1 Reply Latest reply: Nov 30, 2012 12:18 PM by DrClap RSS

    HtmlUnit

    655260
      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
          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".