Skip to content

Instantly share code, notes, and snippets.

@matsuhisa
Last active September 19, 2015 09:56
Show Gist options
  • Save matsuhisa/b63b6aeebb4b0d6322d2 to your computer and use it in GitHub Desktop.
Save matsuhisa/b63b6aeebb4b0d6322d2 to your computer and use it in GitHub Desktop.
page_title.js
var url = phantom.args[0] || 'http://www.yahoo.co.jp/';
page = new WebPage();
page.open(url, function(stat){
if(!stat){
phantom.exit();
}
else{
var title = page.evaluate(function(){
return document.title;
});
console.log(title);
phantom.exit();
}
});
@matsuhisa
Copy link
Author

下記で実行

$ phantomjs page_title.js
Yahoo! JAPAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment