1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

E2EテストフレームワークのPlaywrightでlong touch(長押し)を行うには?

Last updated at Posted at 2024-01-11

結論

await page.locator("#example").click({ delay: 5000 });

これで5秒間押し続けたあとに離してくれます。
Reactのuse-long-pressを使用した場合のテストを書いているときに使います。

他にもmodifiersを指定すればShift+クリックなどもシミュレートできます。
clickのoptionsは読んでおくと良いことがあるかも。

参考

delay number (optional)#
Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.
(マウスを押してから離すまでの時間。ミリ秒で指定)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?