猿问

元素不可见错误(无法单击元素)

我想单击一个单选按钮,出现在网页上。代码如下:


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>

Tesstcase:


// 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)量角器演示应用检查项目数


信息:


失败:元素不可见


我也尝试过:


element(by.css('[ng-click="main.setCity('Mumbai', 1)"]')).click();

它给出了错误:


[16:16:26] E / launcher-参数列表后出现错误:SyntaxError:缺少)


请提出建议,单选按钮将如何获得点击?


慕哥6287543
浏览 519回答 1
1回答
随时随地看视频慕课网APP
我要回答