我想抓取一个正在使用AngularJs的网站,页面上有四个单选按钮,其中有两个'ng-required = true'。所有四个按钮都被选中,但是当我点击提交按钮时,即使选择了按钮,它也会在单选按钮上出现错误。我截图,甚至在屏幕截图中显示选中的单选按钮。我试图覆盖验证,但没有任何工作。请帮助这里是HTML和代码使用Angular js抓取网站
的Html 这是公共服务的单选按钮
<input id="publicServiceTrue" type="radio" value="false"
name="ibrComposite.application.pslfIndicator"
ng-model="pslf" target="dependents_section_div"
ng-required="true"/>
婚姻状况单选按钮
<input id="maritalStatusSingle" type="radio" value="SINGLE"
name="ibrComposite.application.maritalStatus"
ng-model="maritalStatus" ng-required="true" />
//卡斯帕代码
casper.then(function() {
this.evaluate(function() {
$('#applicationReason_NEW').prop("checked", true);
});
this.evaluate(function() {
$('publicServiceTrue').prop("checked", true); // This radio button shows error even when it is selected
});
this.evaluate(function(){
$('#applicationNbChildren').val('0').change();
$('#applicationNbDep').val('0').change();
});
casper.wait(800, function(){
this.capture('IRS/Third_button.png')
});
this.evaluate(function() {
$('#maritalStatusSingle').prop("checked", true); // This radio button shows error even when it is selected
});
casper.wait(1000, function(){
this.capture('IRS/Fourth_button.png')
});
document.querySelectorAll("input[type='submit']")[0].click();
});
报废一个网站?或刮。也不知道你实际上在问什么...... – Darren
请增加清晰度。如果是这样的话,还要分享你的CasperJS代码。 –
请[编辑问题](http://stackoverflow.com/posts/40793931/edit)包含HTML和JavaScript。作为评论,它们是不可读的。 – georgeawg