我使用量角器来自动化我的应用程序,我有一个奇怪的切换按钮,它在html源代码中没有按钮文本,而是返回一个Web服务响应,我是Web服务的新手概念
切换按钮源代码:
<div class="assessment-config-switch assessment-switch">
<input id="fire_{"specialtyId":3,"activeTf":true,"specialtyName":"GI","quickCode":"GI","amaSpecialtyCode":null,"licenseKindId":null,"type":null,"itemId":3,"itemType":null,"itemName":"GI"}" class="showhideswitch-checkbox ng-untouched ng-valid ng-dirty ng-valid-parse" type="checkbox" ng-click="assessmentConfigCtrl.saveToggleOption(assessmentConfigCtrl.fireOptions)" ng-model="assessmentConfigCtrl.fireOptions.configFlagTf">
<label class="showhideswitch-label" for="fire_{"specialtyId":3,"activeTf":true,"specialtyName":"GI","quickCode":"GI","amaSpecialtyCode":null,"licenseKindId":null,"type":null,"itemId":3,"itemType":null,"itemName":"GI"}">
<span class="showhideswitch-inner"></span>
</label>
</div>
</div>
每当我点击切换按钮时,我都会收到网络服务响应:
[
{
"configToggleMapId": 1086,
"configId": 20,
"organizationId": 76,
"specialtyId": 3,
"configFlagTf": true,
"configValue": null,
"config_Name": "Fire_Risk",
"isUpdated": true
}
]
当我点击隐藏时,响应将是
[
{
"configToggleMapId": 1086,
"configId": 20,
"organizationId": 76,
"specialtyId": 3,
"configFlagTf": false,
"configValue": null,
"config_Name": "Fire_Risk",
"isUpdated": true
}
]
我需要根据返回值来获取&#34; configFlagTf&#34; 的值。
答案 0 :(得分:1)
我同意alecxe。使用Protractor,您只能获得用户可能拥有的信息。作为用户,您可以按颜色查看切换按钮的状态。
您应该能够通过编写类似myButton.getCssValue(&#39; color&#39;)的内容来获取按钮的颜色。
问题是,如果更改按钮的颜色,测试将会产生错误结果。