【发布时间】:2019-09-06 17:34:38
【问题描述】:
您好,我需要使用浏览器自动化在我的站点中抓取结果信息。我有这个脚本:
var casper = require('casper').create(); console.log("casper 创建成功");
casper.start("https://portale.spefin.it/anagraph/legalperson/atc", function() { console.log("连接 URL 正常");
// set a wait condition to make sure the page is loaded (particularly iframe in my case)
//fill out the form
this.fillSelectors("form[name='login']",{
'input#username' : "XXXXXXXXX",
'input#pw' : "XXXXXXXX"
});
console.log("Renseignement login et pass OK");
// click the login button
this.click("button[type='submit']");
console.log("Passage bouton login OK");
// switch to iframe (won't be necessary for most)
this.page.switchToChildFrame('https://portale.spefin.it/anagraph/legalperson/atc');
console.log("Switch page OK");
this.wait(5000,function(){
console.log("Attente 5 sec OK");
this.fillSelectors("form[name='advancedFilterForm']",{
'input#tax_code' : "11057560150"
});
console.log("partita iva ok!");
// Test d'une zone sur la page pour valider la connexion
//casper.waitForSelector('.area-status', function() {
//console.log("Validation element sur la page OK");
//});
});
});
问题是页面没有设置,表单没有找到......请帮帮我!
【问题讨论】:
-
登录正常!第二页和表单不行!
标签: casperjs