For anyone else who may run into this error (haven't dug into why this happens) the JavaScript code to execute must start on the first line of a multi-line string.
Returns 0:
script = """
await (async function () {
var pairs = document.cookie.split(";");
var cookies = {};
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
cookies[(pair[0]+'').trim()] = unescape(pair.slice(1).join('='));
}
return cookies;
})()
"""
Returns 10:
script = """10
await (async function () {
var pairs = document.cookie.split(";");
var cookies = {};
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
cookies[(pair[0]+'').trim()] = unescape(pair.slice(1).join('='));
}
return cookies;
})()
"""
Returns the expected value of cookies:
script = """await (async function () {
var pairs = document.cookie.split(";");
var cookies = {};
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
cookies[(pair[0]+'').trim()] = unescape(pair.slice(1).join('='));
}
return cookies;
})()
"""
For anyone else who may run into this error (haven't dug into why this happens) the JavaScript code to execute must start on the first line of a multi-line string.
Returns
0
:Returns
10
:Returns the expected value of
cookies
: