Trying to log in using a JavaScript command, but even after using executeJavaScript()
, the previous page content continues to display. The
checkLogin(9143088043,123456,-1,false)
command should connect to a new page.
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38);
final HtmlPage page1 = webClient.getPage("http://10.254.1.4:90/login.aspx?tt=1");
String javaScriptCode = "checkLogin(9143088043,123456,-1,false);";
ScriptResult r= page1.executeJavaScript(javaScriptCode);
HtmlPage page2=(HtmlPage) r.getNewPage();
System.out.println(page2.getWebResponse().getContentAsString()); //prints the last page content
This error message is shown:
run:
Oct 29, 2015 2:45:16 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Obsolete content type encountered: 'application/x-javascript'.
Oct 29, 2015 2:45:17 PM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError
SEVERE: runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: *:x).] sourceName=[http://10.254.1.4:90/Script/jquery-1.10.2.min.js] line=[4] lineSource=[null] lineOffset=[0]
...
BUILD STOPPED (total time: 19 seconds)