From: Ahmed A. <asa...@ya...> - 2015-06-22 09:25:53
|
Hi Vasu, There is no exception with me with the below: final CollectingAlertHandler handler = new CollectingAlertHandler(); try (final WebClient webClient = new WebClient()) { webClient.setAlertHandler(handler); final HtmlPage page = webClient.getPage("http://www.patcurtis.com/captcha/recaptcha_demo.php"); Thread.sleep(5000); } finally { for (String x : handler.getCollectedAlerts()) { System.out.println("Alert " + x); } } Ahmed From: Vasudevan Comandur <vco...@gm...> To: Ahmed Ashour <asa...@ya...>; "htm...@li..." <htm...@li...> Sent: Friday, June 19, 2015 5:53 PM Subject: Re: [Htmlunit-user] HTMLUnit does not seem to execute the Javascript Hi Ahmed, This is the error I am getting during script execution. I saw the download of recaptcha.js file happening. Inside Catch of With-page-withproxy #<ScriptException com.gargoylesoftware.htmlunit.ScriptException: Wrapped com.gargoylesoftware.ht mlunit.ScriptException: Exception invoking jsxFunction_createElement (dnaukri.clj#2503)> Is the same error happening to you or you are able to get the successful execution of JS? Thanks in advance for your help. Regards Vasu On 19 June 2015 at 18:42, Ahmed Ashour <asa...@ya...> wrote: Hi Vasu, The URL provided is of javascript. Please provide the URL of the html used, or your minimal java code. Ahmed From: Vasudevan Comandur <vco...@gm...> To: "htm...@li..." <htm...@li...> Sent: Friday, June 19, 2015 12:40 PM Subject: [Htmlunit-user] HTMLUnit does not seem to execute the Javascript Hi, I tried the initial URL http://www.google.com/recaptcha/api/challenge?k=6Lf1-AQAAAAAAL9EskceOVja5Uh5_yo1FRtb1Q83 to google recaptcha service which sent the response a javascript file. The javascript file had a line as follows which is given below: *********************************************** var RecaptchaState = { challenge : '03AHJ_VuvDfAzpjod2KO2emYL2RLhxNxZvUyYqynapgkkc_OkLbqV93bxmdirD3B4Wtd66edBqRc_k6OZfBQ1XVAA9i0uMHPjQOKJ46OLZm0UenLc7trte3O6VMfItNaGtMGZGj35Sod10ITmuYFUwHjkHoak4OkacvVaJmXpnynPFfheVoqLO-ier_b2LmNpcfIXoIUqMACHWmf5JJYpKN_j7Hj2Xw2G9dyKAgmOpZkxsyV_n-9rNQqWdO0CcDddZlGc99CnadTMluLHl8gTwYsU15lqTD3DhbQ', timeout : 1800, lang : 'en', server : 'http://www.google.com/recaptcha/api/', site : '6Lf1-AQAAAAAAL9EskceOVja5Uh5_yo1FRtb1Q83', error_message : '', programming_error : '', is_incorrect : false, rtl : false }; document.write('<scr'+'ipt type="text/javascript" s'+'rc="' + RecaptchaState.server + 'js/recaptcha.js"></scr'+'ipt>'); ************************************************** I did not see the request in Charles for downloading the recaptcha.js as part of JS execution in HTMLUnit. I had enabled webclient to execute JS. Is there any issue with HTMLUnit.? I see the normal browser sending the request to download the recaptcha.js file. Any idea why this discrepancy. Any pointers and help is greatly appreciated Regards Vasu ------------------------------------------------------------------------------ _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user ------------------------------------------------------------------------------ _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |