javascript - ReferenceError: "validate" is not defined. while trying to submit a form with HTMLUnit -
i want submit form this site htmlunit error in title.
here code:
try (final webclient webclient = new webclient(browserversion.chrome, "127.0.0.1", 57703)) { //webclient.getoptions().setthrowexceptiononscripterror(false); final htmlpage page1 = webclient.getpage("http://tagmp3.net/"); final htmldivision div = (htmldivision) page1.getelementbyid("urlform"); final domnodelist<domelement> forms = page1.getelementsbytagname("form"); final htmlform form = (htmlform) forms.get(0); final htmltextinput textfield = form.getinputbyname("filepath"); final htmlsubmitinput button = form.getinputbyname("button"); textfield.setvalueattribute(url); final htmlpage page2 = button.click(); system.out.println(page2.getbaseurl()); }
and here error get:
ecmaerror: linenumber=[4] column=[0] linesource=[<no source>] name=[typeerror] sourcename=[http://code.jquery.com/jquery-3.1.1.min.js] message=[typeerror: cannot set property "innerhtml" of undefined "<form></form><form></form>" (http://code.jquery.com/jquery-3.1.1.min.js#4)] com.gargoylesoftware.htmlunit.scriptexception: typeerror: cannot set property "innerhtml" of undefined "<form></form><form></form>" (http://code.jquery.com/jquery-3.1.1.min.js#4) @ com.gargoylesoftware.htmlunit.javascript.javascriptengine$htmlunitcontextaction.run(javascriptengine.java:894) @ net.sourceforge.htmlunit.corejs.javascript.context.call(context.java:637) @ net.sourceforge.htmlunit.corejs.javascript.contextfactory.call(contextfactory.java:518) blah blah blah....
i tried turn off script error didn't work.
by way found in html of website:
<form onsubmit="return validate(this)" method="post" action="index.php">
how can fixed?
the edge support still incomplete, can please try firefox 52 or chrome simulation. please use latest snapshot build.
wiki
Comments
Post a Comment