0 Replies Latest reply: Dec 1, 2012 12:02 AM by 655260 RSS

    HtmlUnit - setAttributeValue or setHiddenInputValue

    655260
      Hello again. I can get the attribute value with this method:

      -----

      WebClient client = new WebClient();

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

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

      System.out.println(hidden.getValueAttribute());

      -----

      The output = 12345

      -----

      Now I need to send this attribute value along with my next page request. The following method would work:

      HtmlPage page = client.getPage ("http://mydomain.com/nextpage.jsp?pagecodes=12345");

      -----

      But the above method is cumbersome when submitting a large number of values. I am seeking a method like the following pseudocode:

      -----

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

      page.setHiddenInputValue("pagecodes") = 12345;

      -----

      Any suggestions are greatly appreciated.