本文へジャンプ

react$$

react$$コマンドは、実際の名前で複数のReactコンポーネントをクエリし、propsとstateでフィルタリングするのに役立つコマンドです。

情報

このコマンドは、React v16.xを使用するアプリケーションでのみ動作します。セレクタガイドで、Reactセレクタの詳細をご覧ください。

使用方法
browser.react$$(selector, { props, state })
パラメータ
名前詳細
selector文字列Reactコンポーネントの
options
オプション
ReactSelectorOptionsReactセレクタオプション
options.props
オプション
オブジェクト要素が含むべきReact props
options.stateArray<any>numberstringobjectboolean要素が属するべきReact state
pause.js
it('should calculate 7 * 6', async () => {
await browser.url('https://ahfarmer.github.io/calculator/');

const orangeButtons = await browser.react$$('t', {
props: { orange: true }
})
console.log(await orangeButtons.map((btn) => btn.getText()));
// prints "[ '÷', 'x', '-', '+', '=' ]"
});

ようこそ!お手伝いできることはありますか?

WebdriverIO AI Copilot