I need to get some content from the page, but if I use fillSelectors()
the content is not load. Maybe i need use evaluate()
, but i dont undestend where and how.
var casper = require('casper').create() casper.start('http://console.matomycontentnetwork.com/', function() { this.fillSelectors('form#login-form', { 'input[name="username"]': 'jpost', 'input[name="password"]': 'matomy123' }, true); this.clickLabel("Sign In", 'button'); }); casper.then(function() { var start_date = '09/01/2015'; var end_date = '10/07/2015'; this.evaluate(function() { $('#report-range').val('custom').change(); }); this.fillSelectors('form#report-form', { 'input[name="report[start_date]"]': start_date, 'input[name="report[end_date]"]': end_date, 'input[id="grouping-option-3"]' : true, 'input[id="grouping-option-2"]' : true, 'input[id="grouping-option-4"]' : true }, true); this.click("#run-report"); this.wait(10000, function () { this.echo('.geo_country_name.innerText: ' + this.evaluate(function() { return document.querySelector('.geo_country_name').innerText; })); this.echo('td.alignright:nth-child(5).innerText: ' + this.evaluate(function() { return document.querySelector('td.alignright:nth-child(5)').innerText; })); }); }); casper.run();
Can you help with that?