1

I'm new to the HTMLUNIT, When I run the below code.

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;

public class WeBrowser {

    public void homePage() throws Exception {

        final WebClient webClient = new WebClient();
        // Get the first page
        final 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.
        final HtmlForm form = page1.getFormByName("myform");
        final HtmlSubmitInput button = form.getInputByName("submitbutton");
        final HtmlTextInput textField = form.getInputByName("userid");
        // Change the value of the text field
        textField.setValueAttribute("root");
        // Submit the form by clicking the button and get back the second page.
        final HtmlPage page2 = button.click();

        webClient.closeAllWindows();
    }
}

It shows the following Error :

Exception in thread "main" org.apache.bcel.verifier.exc.AssertionViolatedException: 

FOUND:
INTERNAL ERROR: Oops!
Exiting!!

at org.apache.bcel.verifier.exc.AssertionViolatedException.main(AssertionViolatedException.java:102)
Tiny
  • 27,221
  • 105
  • 339
  • 599
user2782522
  • 191
  • 1
  • 3
  • 13

2 Answers2

0

Yesterday I have almost same problem, Alhtough it looks odd but try by debugging rather than running, or add some delay before clicking submit button

    Thread.sleep(10000);

and also take a look at this answer AssertionViolatedException

Community
  • 1
  • 1
Tasawer Nawaz
  • 927
  • 8
  • 19
0

I was getting the same error using eclipse to run java code that had previously worked ok. After using 'project>>clean>>all projects' the problem disappeared. Don't know what triggered it but all projects in the workspace were affected.

stegzzz
  • 407
  • 4
  • 9