From: Ronald B. <rb...@rb...> - 2018-10-05 15:51:31
|
Hi Filip, did a short test with this code public static void main(String[] args) throws Exception { String uri = "https://www.t-mobile.cz/sms/closed.jsp"; try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_60)) { webClient.getOptions().setThrowExceptionOnScriptError(false); HtmlPage page = webClient.getPage(uri); webClient.waitForBackgroundJavaScriptStartingBefore(1 * 1000); System.out.println("----------------"); System.out.println(page.asText()); System.out.println("----------------"); } and the output looks good so far for me. You are right there are some log output complaining about problems with the web site. >WARNING: Obsolete content type encountered: 'text/javascript'. The author of the site seems to follow an old web standard :-) > An invalid or ill.... This is the usual output you get if the site uses e.g. jquery. This kind of libs trying different selectors not (yet) supported by real browsers also (but real browsers are not logging the error info) and using some fallback code if the browser does not support the css sel. >SEVERE: runtimeError: message=[Exceeded maximum stack depth] I have seen this in the past as result of a real strange IE detection code. And there is the real js error reported in the browser also 'missin }' - shame on T-Mobile or at least the testers there. Using tools like HtmlUnit / Wetator will help :-) To sum it up, you can ignor the rest of the messages as long as your page content (dom tree) is the right one. RBRi On Wed, 3 Oct 2018 09:02:08 +0200 Filip Pekarek wrote: > >Hello, I am new to htmlunit. >I need to load page "https://www.t-mobile.cz/sms/closed.jsp" which has new >JS. >I cant load full page. Get result with <noscript> tag. >I tried all BrowserVersion and I am using last htmlunit 2.33. > >My code is: >======== >WebClient webClient = new WebClient(BrowserVersion.FIREFOX_60); > >CookieManager cookieMan = new CookieManager(); >cookieMan = webClient.getCookieManager(); >cookieMan.setCookiesEnabled(true); > >webClient.getOptions().setJavaScriptEnabled(true); >webClient.getOptions().setRedirectEnabled(true); >webClient.getOptions().setCssEnabled(true); >webClient.getOptions().setThrowExceptionOnScriptError(false); >webClient.getOptions().setCssEnabled(true); > >HtmlPage page = webClient.getPage("https://www.t-mobile.cz/sms/closed.jsp"); >webClient.waitForBackgroundJavaScript(30 * 1000); >String pageAsXml = page.asXml(); >======== > >I get debug: >com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify >WARNING: Obsolete content type encountered: 'text/javascript'. > >Sometimes I get debug: >SEVERE: runtimeError: message=[Exceeded maximum stack depth] > > >Is it wrong JS on a page? When I load page via Firefox, debugger gets some >errors too, but the page loads fine. >Any suggestions? > >Thank you for very much your reply. > >Best regards > >Filip > > > >----< Inline text [text-plain-04.txt] >------------------ > > > > >----< Inline text [text-plain-05.txt] >------------------ > >_______________________________________________ >Htmlunit-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > |