0

In my javascript i am converting an svg object into base 64 using

     var svg= svgObject;
    var serializer = new XMLSerializer();
    var svgString = serializer.serializeToString(svg);
    return new Blob([svgString], {type:"application/svg+xml"})

When i run the code in a browser,i am able to get the base64 back properly.

However,when i run the javascript code, using selenium-htmlunit in java, using :

ScriptResult result = page.executeJavaScript(javascriptfunction);

i get this error below :

Cannot find function isFinite in object function Number() { [native code] }.

How do i resolve this error so i can get the base64 image back after executing that javascript using htmlunit ?

learner211
  • 43
  • 4

1 Answers1

0

Have done some tests with the current HtmlUnit code. The function Number.isFinite is available and works fine. You are using the latest version?

RBRi
  • 2,704
  • 2
  • 11
  • 14
  • I am using htmlunit 2.27 and selenium server 3.7.1. Is this version compatible? I was able to get it working by creating a function within my javascript for Number.isFinite – learner211 Dec 07 '17 at 19:06
  • Please try with the latest release 2.28 and the latest HtmlUnit driver (2.28.2). And take care to update all the dependencies also. Technically this is implemented in the customized rhino (core-js) HtmlUnit is using. – RBRi Dec 08 '17 at 07:15
  • thanks ,I will try that. Also,another issue i encounter sometimes, is when i execute a javascript function to return data from the page,it returns null. Is there way to keep executing the same javascript on the same page in htmlunit, until the result is not null? – learner211 Dec 09 '17 at 09:24