casperjs 的问题 about .blank的问题
phantom.outputEncoding="utf-8";
var casper=require('casper').create({请输入代码
clientScripts:[
//ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js
],
pageSettings:{
loadImages:true,
loadPlugins:false,
userAgent:'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
},
logLevel:"debug",
verbose:true
});
var fetcurl="https://www.tripadvisor.cn/Attraction_Review-g303783-d1238293-Reviews-Old_Town_of_Lijiang_China-Lijiang_Yunnan.html";
casper.start(fetcurl,function(){
{
var name = $(this.getpagecontent()).find("#HEADING.heading_title.text");//中国丽江古城Old Town of Lijiang - China
this.echo(name);
}
});
casper.run(function() {
this.echo("this is done ").exit()
});
casperjs crawl.js
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: https://www.tripadvisor.cn/At... HTTP GET
[debug] [phantom] Navigation requested: url=https://www.tripadvisor.cn/At... type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "https://www.tripadvisor.cn/Attraction_Review-g303783-d1238293-Reviews-Old_Town_of_Lijiang_China-Lijiang_Yunnan.html"
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:srcdoc, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://tags.bluekai.com/site... type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://stags.bluekai.com/sit... type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/2 https://www.tripadvisor.cn/At... (HTTP 200)
[info] [phantom] Done 2 steps in 90654ms
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "about:blank"
[stephen@localhost crawl]$ casperjs --ignore-ssl-errors=yes --ssl-protocol=any crawl.js
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: https://www.tripadvisor.cn/At... HTTP GET
[debug] [phantom] Navigation requested: url=https://www.tripadvisor.cn/At... type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "https://www.tripadvisor.cn/Attraction_Review-g303783-d1238293-Reviews-Old_Town_of_Lijiang_China-Lijiang_Yunnan.html"
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/2 https://www.tripadvisor.cn/At... (HTTP 200)
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "about:blank"
[stephen@localhost crawl]$ casperjs --ignore-ssl-errors=yes --ssl-protocol=any crawl.js
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: https://www.tripadvisor.cn/At... HTTP GET
[debug] [phantom] Navigation requested: url=https://www.tripadvisor.cn/At... type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "https://www.tripadvisor.cn/Attraction_Review-g303783-d1238293-Reviews-Old_Town_of_Lijiang_China-Lijiang_Yunnan.html"
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:srcdoc, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://tags.bluekai.com/site... type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://stags.bluekai.com/sit... type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/2 https://www.tripadvisor.cn/At... (HTTP 200)
[info] [phantom] Done 2 steps in 9390ms
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "about:blank"
[stephen@localhost crawl]$ casperjs --ignore-ssl-errors=yes crawl.js
[stephen@localhost crawl]$ casperjs --ignore-ssl-errors=yes --ssl-protocol=any crawl.js
this is done
[stephen@localhost crawl]$ casperjs --ignore-ssl-errors=yes --ssl-protocol=any crawl.js
[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: https://www.tripadvisor.cn/At... HTTP GET
[debug] [phantom] Navigation requested: url=https://www.tripadvisor.cn/At... type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "https://www.tripadvisor.cn/Attraction_Review-g303783-d1238293-Reviews-Old_Town_of_Lijiang_China-Lijiang_Yunnan.html"
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:srcdoc, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://tags.bluekai.com/site... type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=https://stags.bluekai.com/sit... type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/2 https://www.tripadvisor.cn/At... (HTTP 200)
[info] [phantom] Done 2 steps in 68324ms
this is done
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "about:blank"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论