我为AngularJS提供了以下输入标记:
<input type="text" ng-model="user.firstName" class="form-control" id="firstName" name="firstName">
我正在使用以下CasperJS代码来测试值:
test.assertField('firstName', 'A Dummy Name');
对于AngularJS,名称字段不是必需的,我不想使用它。然而,对于CasperJS来说,它是。
我可以使用我的CasperJS测试来使用id或ng-model属性来获取要比较的字段的值吗?据我所知,我不能,因为价值不是属性。
答案 0 :(得分:0)
您可以使用:
test.assertField({type: 'css', path: '#firstName'}, 'First Name ID exists', 'First Name ID does not exist');
或
test.assertFieldCSS('#firstName', 'First Name ID exists', 'First Name ID does not exist');