我正在尝试使用幻像js来抓屏幕。PhantomJS和jquery屏幕抓取 - 无输出
我抄从这个站点的一些phantomjs代码:http://snippets.aktagon.com/snippets/534-How-to-scrape-web-pages-with-PhantomJS-and-jQuery
与剧本开始,我已经修改成这样:http://jsfiddle.net/dqfTa/(见的JavaScript)
我的目标是从网站上收集的价格,这是“.price”标签的内部html,转换为一个javascript数组。现在我正在试图将console.log()它们添加到我的屏幕上。
我通过ubuntu 12.04控制台运行phantomjs v1.6和jquery v1.8。我将用户代理设置为“iPhone”。
这里是我的输出:
[email protected]:~/sandbox$ phantomjs usingjqueryandphantom.js
hello
success
============================================
Step "0"
============================================
它永远不会越过0步我的代码看看,我做了console.log("h1");
但不会输出。我在这里做错了什么?
你试图使用'--remote调试器端口= SOMEPORT'调试,然后要通过'http://本地主机:SOMEPORT'? – FilmJ
您是否在要抓取的页面上下文中运行JavaScript?它不会在页面范围之外做任何事情。 –