Angularjs 使用Angular js抓取网站

Angularjs 使用Angular js抓取网站,angularjs,casperjs,Angularjs,Casperjs,我试图刮一个网站,这是使用AngularJs,有四个单选按钮在第二页上有'ng需要=真'。所有四个按钮都已选择,但当我单击submit按钮时,单选按钮会出现错误,即使选择了按钮,也会将ng required设置为true。我拍了一张截图,甚至截图上也显示了选中的单选按钮。我试图覆盖验证,但没有任何效果。请帮助这里是Html和代码 Html 这是公共服务单选按钮 <input id="publicServiceTrue" type="radio" value="false" name=

我试图刮一个网站,这是使用AngularJs,有四个单选按钮在第二页上有'ng需要=真'。所有四个按钮都已选择,但当我单击submit按钮时,单选按钮会出现错误,即使选择了按钮,也会将ng required设置为true。我拍了一张截图,甚至截图上也显示了选中的单选按钮。我试图覆盖验证,但没有任何效果。请帮助这里是Html和代码

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" />

中的
this
关键字。然后
方法不会绑定到父
this
。而是使用粗箭头
=>
语法

//casper.then(function () {
//Use fat arrow syntax   
casper.then( () => {   
    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
关键字:

var that = this;
casper.then( function() {   
    //this.evaluate(function() {
    that.evaluate(function() {
        $('#applicationReason_NEW').prop("checked", true);
    });

    //this.evaluate(function() {
    that.evaluate(function() {

        $('publicServiceTrue').prop("checked", true); // This radio button shows error even when it is selected
    });
从:

3.3也就是说,在严格模式下,
将在(成功/拒绝处理程序)内部
未定义
;在sloppy模式下,它将是全局对象


放弃一个网站?或者刮。也不知道你到底在问什么…请澄清一下。如果与此相关,请分享您的CasperJS代码。请包含HTML和JavaScript。作为注释,它们是不可读的@georgeawg您可以看到更新后的问题,代码为now可能重复感谢您的回复,但它并没有解决问题,正如我前面提到的,该块中有其他控件已被选中,但其中两个未被选中,我在代码中明确注释了它们
var that = this;
casper.then( function() {   
    //this.evaluate(function() {
    that.evaluate(function() {
        $('#applicationReason_NEW').prop("checked", true);
    });

    //this.evaluate(function() {
    that.evaluate(function() {

        $('publicServiceTrue').prop("checked", true); // This radio button shows error even when it is selected
    });