I m scraping soccer scores data from website. All scores are in a table, every <tr>
has "block home matches 17" and some unique stuff after it.
I tested my xpath in the Chrome dev tools, it recognizes only the table rows I need.
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();
The code returns [] as utils.dump! Why? my xpath is valid!