0
我从网站上刮取足球比分数据。所有比分都在一张桌子上,每个<tr>
都有“封锁主场比赛17”和一些独特的东西。CasperJS'getElementsByXpath返回null与有效的XPath
我在Chrome开发工具中测试了我的xpath,它只识别我需要的表行。
var utils = require('utils');
var casper = require('casper').create();
var xpath = require('casper').selectXPath;
var result = [];
function getScores(){
console.log("getting scores");
result = __utils__.getElementsByXPath("//tr[contains(@id,'block_home_matches_17')");
}
casper.start('http://int.soccerway.com/', function() {
console.log("casper start....");
var l = getScores();
utils.dump(l);
});
casper.run();
该代码返回[] as utils.dump!为什么?我的xpath是有效的!
有关? http://stackoverflow.com/questions/3655549/xpath-containstext-some-string-doesnt-work-when-used-with-node-with-more –