-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Version
1.55
Steps to reproduce
just use page with same element multiple times,
for example multiple continue buttons with 'Continue' span inside.
elm = page.wait_for_selector(CONTINUE_BUTTON_SELECTOR)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.12/dist-packages/playwright/sync_api/_generated.py", line 8182, in wait_for_selector
self._sync(
File "/usr/local/lib/python3.12/dist-packages/playwright/_impl/_sync_base.py", line 115, in _sync
return task.result()
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/playwright/_impl/_page.py", line 423, in wait_for_selector
return await self._main_frame.wait_for_selector(**locals_to_params(locals()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/playwright/_impl/_frame.py", line 369, in wait_for_selector
await self._channel.send(
File "/usr/local/lib/python3.12/dist-packages/playwright/_impl/_connection.py", line 69, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/playwright/_impl/_connection.py", line 558, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Page.wait_for_selector: Timeout 30000ms exceeded.
Call log:
- waiting for locator("span:has-text('Continue')") to be visible
64 × locator resolved to 8 elements. Proceeding with the first one: Continue
Expected behavior
set the first matching element to the elm variable
Actual behavior
as said in logs, should proceed with first match, but instead it throws exception. even if you want to catch the exception and choose element manually, it does not set any value to the elm variable.
Additional context
No response
Environment
- Operating System: [mcr.microsoft.com/playwright/python:v1.55.0-noble]
- CPU: [intel]
- Browser: [MSEdge]
- Python Version: [3.12]
- Other info: tested inside container