33 文字
1 分
Playwrightでファイル選択をする
Playwright は FileChooser オブジェクトを利用すると、ファイル選択をエミュレートできる。
https://playwright.dev/docs/api/class-filechooser
const fileChooserPromise = page.waitForEvent("filechooser");await page.getByText("Upload file").click();const fileChooser = await fileChooserPromise;await fileChooser.setFiles(path.join(__dirname, "myfile.pdf"));
Playwrightでファイル選択をする
https://blog.ohirunewani.com/posts/playwright-filechooser/