1
我想返回最靠近元素父元素的子元素div
。量角器:在一個元素集合中使用where子句
HTML
<div id='Parent'>
<div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
</div>
</div>
量角器
var parent = element(by.id('Parent'));
var topChildren = parent.all(by.tagName('div')).then(elem => [elem[0], elem[1]]); //this doesn't work.
我知道這裏的邏輯可能是錯誤的(將在頂部的兩個元素真正做到了頂級的孩子嗎?),但我不認爲這甚至會返回一組元素。例如,topChildren.getAttribute('class')
將引發topChildren.getAttribute is not a function
,因此它甚至不會將返回視爲一組元素。