次の要素
選択されたDOM要素の次の兄弟要素を返します。
使用方法
$(selector).nextElement()
例
index.html
<div class="parent">
<p>Sibling One</p>
<p>Sibling Two</p>
<p>Sibling Three</p>
</div>
nextElement.js
it('should get text from next sibling element', async () => {
const elem = await $$('p');
const nextElement = await elem[1].nextElement()
console.log(await nextElement.getText()); // outputs: "Sibling Three"
});
戻り値
- <WebdriverIO.Element>