class woob.tools.js.Javascript(script, logger=None, domain='')

Bases: object

HEADER = '\n function btoa(str) {\n var buffer;\n\n if (str instanceof Buffer) {\n buffer = str;\n } else {\n buffer = new Buffer(str.toString(), \'binary\');\n }\n\n return buffer.toString(\'base64\');\n }\n\n function atob(str) {\n return new Buffer(str, \'base64\').toString(\'binary\');\n }\n\n document = {\n createAttribute: null,\n styleSheets: null,\n characterSet: "UTF-8",\n documentElement: {}\n };\n\n history = {};\n\n screen = {\n width: 1280,\n height: 800\n };\n\n var XMLHttpRequest = function() {};\n XMLHttpRequest.prototype.onreadystatechange = function(){};\n XMLHttpRequest.prototype.open = function(){};\n XMLHttpRequest.prototype.setRequestHeader = function(){};\n XMLHttpRequest.prototype.send = function(){};\n\n /* JS code checks that some PhantomJS globals aren\'t defined on the\n * global window object; put an empty window object, so that all these\n * tests fail.\n * It then tests the user agent against some known scrappers; just put\n * the default Tor user agent in there.\n */\n window = {\n document: document,\n history: history,\n screen: screen,\n XMLHttpRequest: XMLHttpRequest,\n\n innerWidth: 1280,\n innerHeight: 800,\n\n close: function(){}\n };\n\n navigator = {\n userAgent: "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0",\n appName: "Netscape"\n };\n '
call(*args, **kwargs)