From: Toddy M. <tod...@en...> - 2005-07-25 20:07:37
|
Hello, I would like to submit a form (post) with HtmlUnit having the Referer request-header field set. It works fine to submit the form but the referer-header field is not set. Is there a way to set the referer when submitting a form? Thanx! -Toddy My code looks like this: public HtmlPage submitRegistration(HtmlPage aPage) { // get the form to process it HtmlForm regForm = aPage.getFormByName("registration"); // get the submit button to later click it HtmlSubmitInput button = (HtmlSubmitInput)regForm.getInputByValue("register"); // get the textfield to enter the name HtmlTextInput textField = (HtmlTextInput)regForm.getInputByName("name"); String nameString = "Homer"; textField.setValueAttribute(nameString); // submit the form and get the response page HtmlPage nextPage = (HtmlPage)button.click(); return nextPage; } |