casperjs 的问题 about .blank的问题

发布于 2022-09-06 05:06:00 字数 14082 浏览 19 评论 0

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文