Phantomjs刮网页function无法正常工作

我正在使用phantomjs来学习如何抓取一个网页,到目前为止我已经开发了以下代码..我知道我能够连接到该网站,但我无法从表中获取数据…我走在正确的轨道上?

我的目标是从本网站的表格中删除数据。 我也明白我需要使用includeJs或者injectJs来等待表加载其他我会抓一个空的html页面。 我试图将这些概念放在一起,但现在已经停留了3天以上..请给出一些指导..

var page = require('webpage').create(); console.log('Welcome to scraping...'); page.open('http://www.inc.com/inc5000/index.html', function(status) { page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() { if (status !== 'success') { console.log('Unable to access network'); } else { var ua = page.evaluate(function() { var DATA = []; var res= document.getElementById((this).find('td')).eq(0).text(); console.log(res); //**See output below for what is happening here** $('tr.ng-scope').each(function(){ var $tds = $(this).find('td'); DATA.push({ rank: $tds.eq(0).text(), company: $tds.eq(1).text(), growth: $tds.eq(2).text(), revenue: $tds.eq(3).text(), industry: $tds.eq(4).text() }); }); console.log(DATA); console.log('Got into func'); //return document.getElementById('myagent').textContent; }); console.log('Got out of function'); console.log(ua); } phantom.exit(); }); }); 

我得到的输出是:

欢迎刮刮……

ReferenceError:找不到变量:angular

http://stage.inc.com/js/Inc5000ListApp.js?UPDATE1:2
http://www.inc.com/inc5000/index.html:2485

TypeError:’null’不是对象(评估’document.getElementById(this.find(’td’))。eq’)

phantomjs://webpage.evaluate():3 //这是什么意思?

phantomjs://webpage.evaluate():20

phantomjs://webpage.evaluate():20

失去了function

空值