我想在网页上点击一个单选按钮,代码如下:
HTML 代码:
<div class="small-checkbox red-theme raleway-regular text-muted2 position-relative">
<div class="city-checkbox inline-block position-relative" ng-class="{'rounded-checkbox': main.current_city_id == 1, 'mb-20': main.ifDeviceIsPhone}">
<label class="mdl-radio mdl-js-radio mdl-js-ripple-effect mh-20" for="mumbaiCity" ng-class="{'is-checked' : main.current_city_id == 1}">
<input type="radio" id="mumbaiCity" class="mdl-radio__button position-relative vertical-middle" name="city" value="1" ng-click="main.setCity('Mumbai', 1)">
<span class="mdl-radio__label position-relative font15"><img class="city-icon" src="../../../assets/img/cities/mumbai-icon.png">Mumbai</span>
</label>
</div>
</div>
测试用例:
// demo-test.js
describe('Protractor Demo App', function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000000;
it('check item count', function() {
browser.get('<link>');
element(by.id('mumbaiCity')).click();
});
});
这个测试出现了错误:
1)Protractor演示应用程序检查项目计数
消息:
失败:元素不可见
我也尝试了:
element(by.css('[ng-click="main.setCity('Mumbai', 1)"]')).click();
出现错误:
[16:16:26] E/launcher - Error: SyntaxError: missing ) after argument list
请建议如何单击单选按钮?