Difference in length of a variable computed by browser and HTMLUnit JS Engine

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Difference in length of a variable computed by browser and HTMLUnit JS Engine

Vasudevan Comandur
Hi All,

   I am using HTMLUnit 2.23 and enabled JS execution. The JS executed by the
   browser is computing value for one variable whose length is always 1230 on FF
   browser.

   The same JS when executed through HTMLUnit/Rhino is not producing the same
   length. It is always far less than what I see for the browser.

    Attached is the HTMLPage which connects to google Recaptcha service.

     It would be great if you can tell me the reason for the difference in length.

    Appreciate your help on this.

Regards
 Vasu

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

recaptcha-naukri.html (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Difference in length of a variable computed by browser and HTMLUnit JS Engine

asashour
Hi Vasu,

Which variable?

Please provide your Java code.

Ahmed



From: Vasudevan Comandur <[hidden email]>
To: "[hidden email]" <[hidden email]>
Sent: Wednesday, January 25, 2017 4:22 PM
Subject: [Htmlunit-user] Difference in length of a variable computed by browser and HTMLUnit JS Engine

Hi All,

   I am using HTMLUnit 2.23 and enabled JS execution. The JS executed by the
   browser is computing value for one variable whose length is always 1230 on FF
   browser.

   The same JS when executed through HTMLUnit/Rhino is not producing the same
   length. It is always far less than what I see for the browser.

    Attached is the HTMLPage which connects to google Recaptcha service.

     It would be great if you can tell me the reason for the difference in length.

    Appreciate your help on this.

Regards
 Vasu

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Difference in length of a variable computed by browser and HTMLUnit JS Engine

Vasudevan Comandur
Hi Ahmed,

    It is the "th" variable. I did not write any java code. I was using Clojure code.

    Below is the clojure code snippet

    (let [act-url (str "http://localhost:8080/vmsconnect/recaptcha-naukri.html")
         ]
           (start-page (do
                      (enable-javascript true)
                      (enable-httpexception false) ; Disable the HTTP and script exceptions
                      (enable-scriptexception true) ; Disable the script exceptions
                      (.addRequestHeader *wc* "Referer" (str "https://resdex.naukri.com/v2/search/pageChange"))
                   act-url)
               (. java.lang.Thread sleep 3000) ; Sleep for 3 seconds
     ;          (hit-count 0)
           (let [src-val (try (with-node (page-root)
                                         (attr (xpath "//img[@id='recaptcha_challenge_image']" :node) "src")
                                      )
                                      (catch Exception e (println "Inside Exception in Captcha Image Fetching" e))
                                 )
                 st1-data (println "THE RESPONSE FROM HOST on EXISTING SESSION AFTER LINKING PROFILE ...." src-val "         ")
                ]
                (.close *wc*)
                   src-val)
       )
     )



Regards
 Vasu

On 26 January 2017 at 22:44, Ahmed Ashour <[hidden email]> wrote:
Hi Vasu,

Which variable?

Please provide your Java code.

Ahmed



From: Vasudevan Comandur <[hidden email]>
To: "[hidden email]" <[hidden email]>
Sent: Wednesday, January 25, 2017 4:22 PM
Subject: [Htmlunit-user] Difference in length of a variable computed by browser and HTMLUnit JS Engine

Hi All,

   I am using HTMLUnit 2.23 and enabled JS execution. The JS executed by the
   browser is computing value for one variable whose length is always 1230 on FF
   browser.

   The same JS when executed through HTMLUnit/Rhino is not producing the same
   length. It is always far less than what I see for the browser.

    Attached is the HTMLPage which connects to google Recaptcha service.

     It would be great if you can tell me the reason for the difference in length.

    Appreciate your help on this.

Regards
 Vasu

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user