2015-01-13 3 views

ответ

0

Вот пример с HtmlUnit

public void submittingForm() throws Exception { 
    final WebClient webClient = new WebClient(); 

    // Get the first page 
    HtmlPage page1 = webClient.getPage("http://some_url"); 

    // Get the form that we are dealing with and within that form, 
    // find the submit button and the field that we want to change. 
    HtmlForm form = page1.getFormByName("myform"); 

    HtmlSubmitInput button = form.getInputByName("submitbutton"); 
    HtmlTextInput textField = form.getInputByName("userid"); 

    // Change the value of the text field 
    textField.setValueAttribute("root"); 

    // Now submit the form by clicking the button and get back the second page. 
    HtmlPage page2 = button.click(); 

    webClient.closeAllWindows(); 
} 
+0

Я попытался это ... но это не работает ... (ошибка в Webclient) –

+0

@LoveenaMathews вы можете дать мне адрес страницы, так что я могу проверить? – Arya

+0

URL: www.safesecurities.com.pk –

Смежные вопросы