The website displays the visitor's IP address in an h1
tag with id = "ip"
When I use return document.querySelector('#ip').innerText;
it displays the correct IP address and everything is well.
However, when I use return $('#ip').text();
it displays null
Any ideas why?
var casper = require('casper').create();
casper.start("http://mikeyaworski.com/IP", function() {
var ip = this.evaluate(function() {
// return document.querySelector('#ip').innerText; // does work
return $('#ip').text(); // doesn't work, but it should
});
this.echo("\nYour public IP address is: " + ip);
});
casper.run();