Skip to content

Instantly share code, notes, and snippets.

@objo
Last active January 26, 2017 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save objo/82f1a51662167ce5c75b23c765e6f475 to your computer and use it in GitHub Desktop.
Save objo/82f1a51662167ce5c75b23c765e6f475 to your computer and use it in GitHub Desktop.
Not finding mySelector variable.
var system = require('system');
var args = system.args;
var page = require('webpage').create();
mySelector = args[1];
system.stdout.write(mySelector);
page.open('http://phantomjs.org', function() {
var elementValue = page.evaluate(function(mySelector) {
return document.querySelector(mySelector).textContent;
}, mySelector);
system.stdout.write(elementValue);
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment