app.component.html如何在Angular 4.0中設置量角器的* ngFor集合?
<div class="student-list" *ngFor="let student of students">
<p>{{student.name}}</p>
</div>
我想測試學生是否有名稱。但是students
是在app.component.ts中設置的列表。
現在我該如何設置量角器的students
?
我已經做了以下
element(by.binding('students')).sendKeys(['abc', 'xyz']);
但是這是行不通的,它拋出Failed: unknown error: angular is not defined
。 什麼是正確的方法?
沒關係。但是,如果我使用by.css元素(by.css('。student-list'))。sendKeys(['abc','xyz']);這也失敗了說沒有找到使用locator的元素:通過(css選擇器,.student-list) –
它應該沒有。 – Sajeetharan
沒有試過。 like(by.css('student-list'))。sendKeys(['abc','xyz']);仍然沒有找到元素 –