Closed himanshu-jain16 closed 8 years ago
@himanshu1691 the common answer for such questions is - write script to run from phantom-js directly, then port to this driver. Or use more high-level libraries. If you are sure your problem is caused by driver - please provide a more short example.
@puzrin
/* global nextPage */
const fib = () => {
// eslint-disable-next-line
page.evaluate(function () {
return nextPage.toString();
}, (err4, result) => {
console.log(result);
browser.exit();
});
// eslint-disable-next-line
page.evaluate(function () {
nextPage();
}, () => {
setTimeout(fib, 10000);
});
};
fib();
As I mentioned in #153, page.evaluate
cannot access variables defined outside of itself, other than document
, window
and other browser (not node variables) global variables.
How to navigagte using this package? From a given URL, it should find out a link to another page and after loading that we should be able to scrape content from that. How can we do that here? Here is the sample code which does not work. Can someone tell me why it doesn't work :