element.all无法列出定位器

时间:2016-07-12 14:24:18

标签: javascript css protractor

the code to be tested is shown in this picture

我在思考元素。但是列表变空了,例如

@echo off
color 1E
title TESTING BATCH FILE
echo Enter your APP INSTALLATION DIRECTORY.  
echo.
echo.
set /p DIR=ENTER THE INSTALLATION DIRECTORY: <<<Prompting From The User>>>
echo DIRECTORY="%DIR%" <<<Set what user typed as a variable>>>
cd %DIR% <<<Execute further commands using it>>>
pause
exit

...

结果是:下拉列表中的总值为:0 列表中的项目数量应为2!

或其他例子;

element.all(by.css('[ng-bind="premiseObj.address"]')).then(function(items){
    console.log("Total values in dropdown are: " + items.length);

element.all(by.binding('premiseObj\.address')).then(function(items)

由于列表为空,这些示例都不起作用。

Protractor 3.3.0,webdriver-manager 2.21。

由于 哈桑

3 个答案:

答案 0 :(得分:0)

不起作用:

element.all(by.repeater('premiseObj.address')).count().then(function(items){
    console.log("Total values in dropdown are: " + items);
}

你不需要逃避'。'在定位器中。

答案 1 :(得分:0)

在这种情况下,

by.repeater()应该是首选定位器:

var premises = element.all(by.repeater('premiseObj in contractsObj.premiseList'));
expect(premises.count()).toEqual(2);

不需要转发转发器字符串中的点

答案 2 :(得分:0)

错误是由省略ignoresynchronization = false引起的;在测试代​​码的非角度部分之后。

但在使用
之前仍然需要browser.sleep(1000) element.all(by.repeater('premiseObj in contractsObj.premiseList'));

相关问题