Node.js App, selenium webdriver, Chrome headless. My app needs to scrape a list of websites and one of them has attached information to global window variable.
I have tried the following and it throws an error:
// .... more code to load page up to this point
driver.execute(function () {
console.log(window.info);
return window;
}).then(function (result) {
console.log( "\n\ninfo from window object: " + util.inspect(result) );
}).catch( (err) => {
console.error(" Caught Error for window: " + err);
});
// throws ERROR: Caught Error for window: TypeError: command.setParameter is not a function
Is there a way to access the global window variable from Selenium (preferably headless, but if I should use head then I can try that) ?