0
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?

page.goto メソッドとは

Posted at

page.goto メソッドは、Playwrightのブラウザ自動化ライブラリで、指定したURLにページを遷移させるために使用されます。

1.URLにナビゲート

page.goto(url) を呼び出すと、指定したURL(url)にブラウザのページが遷移します。これにより、新しいページがロードされ、指定されたWebページが表示されます。

2.非同期処理

page.goto は非同期メソッドであり、await を使って完了を待つことができます。ページの遷移が完了するまで次の処理が進まないようにするため、通常 await を使用します。

3.オプション

await page.goto('https://example.com', {
  waitUntil: 'networkidle', // ページのネットワーク接続がアイドル状態になるまで待つ
  timeout: 60000, // 最大60秒待機
});

page.goto にはオプションを指定することができます。例えば、ページの遷移時にタイムアウトを設定したり、リダイレクトを無視するなどの設定が可能です。

まとめ

page.goto メソッドは、テストシナリオの中でページを特定のURLに遷移させる際に非常に便利です。

0
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
0
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?