MCPcopy Index your code
hub / github.com/microsoft/playwright-python / test_should_accept_single_file

Function test_should_accept_single_file

tests/async/test_input.py:129–141  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

127
128
129async def test_should_accept_single_file(page: Page) -> None:
130 await page.set_content('<input type=file oninput="javascript:console.timeStamp()">')
131 async with page.expect_file_chooser() as fc_info:
132 await page.click("input")
133 file_chooser = await fc_info.value
134 assert file_chooser.page == page
135 assert file_chooser.element
136 await file_chooser.set_files(FILE_TO_UPLOAD)
137 assert await page.eval_on_selector("input", "input => input.files.length") == 1
138 assert (
139 await page.eval_on_selector("input", "input => input.files[0].name")
140 == "file-to-upload.txt"
141 )
142
143
144async def test_should_be_able_to_read_selected_file(page: Page) -> None:

Callers

nothing calls this directly

Calls 5

set_contentMethod · 0.45
expect_file_chooserMethod · 0.45
clickMethod · 0.45
set_filesMethod · 0.45
eval_on_selectorMethod · 0.45

Tested by

no test coverage detected