We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTMLにはこんな風にテキストが10個あるとする
<div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div> <div>FOO TEXT</div>
専用の書き方があるわけではなく、ループで回せば良いようだ
画面に FOO TEXT というテキストが10個あることを検証する例
FOO TEXT
for (let i = 0; i < 10; i++) { await expect(page.getByText('FOO TEXT').nth(i)).toBeVisible() }
なお Playwright の nth では指定順番の要素を得られるようだが、 0始まりのカウントのようだ
nth(0)
nth(1)
Returns locator to the n-th matching element. It's zero based, nth(0) selects the first element.
https://playwright.dev/docs/api/class-locator
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ
https://github.com/YumaInaura/YumaInaura
The text was updated successfully, but these errors were encountered:
No branches or pull requests
例
HTML
HTMLにはこんな風にテキストが10個あるとする
Playwright
専用の書き方があるわけではなく、ループで回せば良いようだ
画面に
FOO TEXT
というテキストが10個あることを検証する例nth
なお Playwright の nth では指定順番の要素を得られるようだが、 0始まりのカウントのようだ
nth(0)
が1番目の要素nth(1)
が1番目の要素https://playwright.dev/docs/api/class-locator
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ
プロフィール・経歴
https://github.com/YumaInaura/YumaInaura
The text was updated successfully, but these errors were encountered: