Your question
Context:
- Playwright Version: 1.12.0
- Operating System: Windows
- Python version: 3.8
- Browser: Chromium
Code Snippet
This code is copied from #536 (comment) . I've got the same error in my own code. Not sure if it's a bug or I've done something wrong myself.
from asyncio import CancelledError, FIRST_COMPLETED, create_task, run, wait
from contextlib import suppress
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto("http://playwright.dev")
done, pending = await wait(
{
create_task(page.wait_for_selector("input[placeholder='search' i]")),
create_task(page.wait_for_selector("input[placeholder='will-never-find' i]")),
}, return_when=FIRST_COMPLETED
)
for task in pending:
task.cancel()
with suppress(CancelledError):
await task
await browser.close()
run(main())
got error:
Future exception was never retrieved
future: <Future finished exception=Error('Target closed\n=========================== logs ===========================\nwaiting for selector "input[placeholder=\'will-never-find\' i]" to be visible\n============================================================')>
playwright._impl._api_types.Error: Target closed
=========================== logs ===========================
waiting for selector "input[placeholder='will-never-find' i]" to be visible
============================================================
Your question
Context:
Code Snippet
This code is copied from #536 (comment) . I've got the same error in my own code. Not sure if it's a bug or I've done something wrong myself.
got error: