teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

locator.scrollIntoViewIfNeededを使うケースを追加

2022/07/30 15:24

投稿

aokiken
aokiken

スコア38

answer CHANGED
@@ -1,8 +1,11 @@
1
- 以下のつが思いつきました
1
+ 以下の3つが思いつきました
2
2
 
3
3
  mouse-wheelを使う
4
4
  https://playwright.dev/docs/api/class-mouse#mouse-wheel
5
5
 
6
+ locator.scrollIntoViewIfNeededを使う
7
+ https://playwright.dev/docs/api/class-locator#locator-scroll-into-view-if-needed
8
+
6
9
  jsを実行してscrollさせる
7
10
  ```typescript
8
11
  await page.evaluate(() => window.scrollTo(0, 0));