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"

阅读 3.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进