From: Ahmed A. <asa...@ya...> - 2015-08-06 11:43:52
|
Hi Vasu, You can't use HtmlUnit to get ScriptObject and then pass it to Rhino Engine, the two JS engines are in different java packages. If you have an issue with HtmlUnit JS engine, then please post a test case. Ahmed From: Vasudevan Comandur <vco...@gm...> To: "htm...@li..." <htm...@li...> Sent: Wednesday, August 5, 2015 6:59 PM Subject: [Htmlunit-user] How to allow window.atob and window.btoa methodexecution in HTML Unit from JS Hi All, I am using the default JS engine that is bundled with JDK 1.6 (Rhino Engine). I have been trying to use the methods supported by javax.script.* classes to execute the javascript methods. One of the javascript files use window.atob and window.btoa functions and that was throwing exception since window object was undefined. I used HTMLUnit to instantiate a webClient and followed by getScriptObject to get the Window object. This window object was passed to JS using engine.put method. I was not getting the expected results after window.atob call in JS. I also tried printing the window object using window.toString(). I saw the signature of the atob method but the not code inside the method. What should I do in JS so that window.atob function defined in HTMLUnit under WIndow class gets executed correctly. Looking forward to your help and suggestions to solve this problem. Regards Vasu PS: I am not using the JS engine bundled with HTMLUnit. |