是否可以通过模板引用变量名称(#)定位元素?
<input #someInput>
答案 0 :(得分:0)
您可以使用量角器定位器cssContainingText
Element(by.cssContainingText('input', 'variable name'));
答案 1 :(得分:0)
Update:
These template references do not get rendered in the DOM so you will not be able to use them to identify your elements. They are only present in your Angular templates.
Can you try just locating by css directly like so
element(by.css('#someInput'));
I manually tested this in the browser and it appeared to work as seen below.