Timeout and missing element with playwright local #96
Replies: 1 comment
-
|
Hi @SamuelBuhan! I'm Dosu and I’m helping the flights team. The timeout is happening because the Playwright script is waiting for the selector For the 401 "no token provided" error, that's related to the remote fallback mode, not local mode. The library now embeds a default consent cookie bundle to bypass Google's consent page, but you can override this by passing your own cookies or setting Make sure you’ve installed Playwright and the Chromium browser as described in the docs. If you still see issues after updating, try running Playwright in non-headless mode for debugging, or explicitly provide cookies if you suspect authentication problems. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was wondering if you know more about this bug I have. I use "local" playwright fetch_mode due to token issue and try to execute:
result: Result = get_flights( flight_data=[ FlightData(date="2025-03-01", from_airport="MHT", to_airport="CDG") ], trip="one-way", seat="economy", passengers=Passengers(adults=2, children=1, infants_in_seat=0, infants_on_lap=0), fetch_mode="local", )The result is:
`Traceback (most recent call last):
File "/Users/sbuhan/workspace/projects/python/fast-flight/main.py", line 9, in
result: Result = get_flights(
^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/fast_flights/core.py", line 68, in get_flights
return get_flights_from_filter(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/fast_flights/core.py", line 49, in get_flights_from_filter
res = fallback_playwright_fetch(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/fast_flights/fallback_playwright.py", line 44, in fallback_playwright_fetch
assert res.status_code == 200, f"{res.status_code} Result: {res.text_markdown}"
^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 401 Result: {"error":"no token provided"}
(.venv) {14:01}~/workspace/projects/python/fast-flight ➭ /Users/sbuhan/workspace/projects/python/fast-flight/.venv/bin/python /Users/sbuhan/workspace/projects/python/fast-flight/main.py
[<Airport.MANCHESTER_BOSTON_REGIONAL_AIRPORT: 'MHT'>]
[<Airport.PARIS_ORLY_AIRPORT: 'ORY'>]
Traceback (most recent call last):
File "/Users/sbuhan/workspace/projects/python/fast-flight/main.py", line 9, in
result: Result = get_flights(
^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/fast_flights/core.py", line 68, in get_flights
return get_flights_from_filter(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/fast_flights/core.py", line 46, in get_flights_from_filter
res = local_playwright_fetch(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/fast_flights/local_playwright.py", line 22, in local_playwright_fetch
body = asyncio.run(fetch_with_playwright(url))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.12/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.12/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.12/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/fast_flights/local_playwright.py", line 13, in fetch_with_playwright
await locator.wait_for()
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/playwright/async_api/_generated.py", line 17993, in wait_for
await self._impl_obj.wait_for(timeout=timeout, state=state)
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/playwright/_impl/_locator.py", line 710, in wait_for
await self._frame.wait_for_selector(
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/playwright/_impl/_frame.py", line 369, in wait_for_selector
await self._channel.send(
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 69, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbuhan/workspace/projects/python/fast-flight/.venv/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 559, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Locator.wait_for: Timeout 30000ms exceeded.
Call log:
Any thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions