量角器在浏览器中找不到任何元素渲染元素

时间:2015-07-08 21:41:29

标签: javascript angularjs testing jasmine protractor

有没有人遇到过你的量角器脚本无法找到任何元素(count == 0)然而元素在浏览器中呈现的情况?我正在测试我们最近更改的网站部分,现在测试失败了。当我使用“elementor”或其他调试工具时,它表示找不到页面上所有元素的元素。然而页面正确呈现。

当我使用elementor进行检查时,我看到:

[by.css('section[ng-controller="app.DatepickerController as vm"]'): “0”

其中0是计数。

[by.css('section.panel-body'): "12"

其中12是同一元素的计数。

以下是HTML的示例。它应该显示“Datepicker”。

<section class="panel-body ng-scope" ng-controller="app.DatepickerController as vm">
<div class="row">
<div class="col-md-4">
<h3>Datepicker</h3>
<div td-datepicker="" show-ignore-year="vm.showIgnoreYear" show-all-before="vm.showAllBefore" all-before="vm.allBefore" show-all-after="vm.showAllAfter" all-after="vm.allAfter" ignore-year="vm.ignoreYear" date="vm.date" disabled="vm.dateIsDisabled" class="ng-isolate-scope">
<div class="td-datepicker" ng-class="{ open: vm.open, invalid: !vm.isValid &amp;&amp; vm.hasOpened &amp;&amp; !vm.open }">
<div class="input-group"><div class="td-datepicker-value" ng-click="vm.toggle()" ng-disabled="vm.   disabled" ng-class="vm.disabled ? 'disabled' : ''">
<span class="td-datepicker-value-month ng-binding" ng-class="{ active: vm.open &amp;&amp; vm.mode === 'month' }">MM</span>/
<span class="td-datepicker-value-day ng-binding" ng-class="{ active: vm.open &amp;&amp; vm.mode === 'day' }">DD</span>/
<span class="td-datepicker-value-year ng-binding" ng-class="{ active: vm.open &amp;&amp; vm.mode === 'year' }">YYYY</span>
</div>
<div ng-class="{ 'active': vm.open, 'disabled': vm.disabled}" class="input-group-addon" ng-click="vm.toggle()" ng-disabled="vm .disabled"><i class="md md-today"></i>
</div>

<div ng-show="vm.open" class="td-datepicker-popover ng-hide">
月 天 年       

------控制器 (function(){

'use strict';

angular
    .module('app')
    .controller('app.DatepickerController', appDatepickerController);

function appDatepickerController() {
    /*jshint validthis:true */
    var vm = this;
    // Disable functionality from controller
    // Using Date Picker as example
    vm.dateIsDisabled = true;

    // Date picker
    vm.date = undefined;
    vm.showIgnoreYear = true;
    vm.showAllBefore = false;
    vm.allBefore = false;
    vm.showAllAfter = true;
    vm.allAfter = true;
    vm.showIgnoreYear = false;
    vm.ignoreYear = false;

    // Year picker
    vm.year = undefined;

    // Month picker
    vm.myear = undefined;
    vm.mmonth = undefined;

    // Quarter picker
    vm.qyear = undefined;
    vm.qquarter = undefined;

    // Week picker
    vm.wyear = undefined;
    vm.wweek = undefined;
}

})();

1 个答案:

答案 0 :(得分:0)

在说服开发人员认为这是编码问题而不是浏览器问题之后,这个问题得到了解决。