ERR_NAME_NOT_RESOLVED when running example with patchright
Hello and thank you for this project! Looking for guidance, as I'm not sure what I'm doing wrong.
I tried to run the trunstile example with Patchright: https://github.com/techinz/playwright-captcha/blob/main/examples/cloudflare/click_turnstile.py
(and I followed the helpful comment in there only changed headless=False)
As soon as page.goto called I get this exceptions
patchright._impl._errors.Error: Page.goto: net::ERR_NAME_NOT_RESOLVED at https://2captcha.com/demo/cloudflare-turnstile
Running everything without initializing ClickSolver works fine... Any help appreciated!
EDIT: seems like if I comment out https://github.com/techinz/playwright-captcha/blob/c0799b2d06b644c9b8a3ee23fb13b2185a8d3a60/playwright_captcha/solvers/base_solver.py#L102 the page loads, but of ofc the captcha is not detected now.
Versions:
- OS: Linux Mint 22
- Python 3.14.3
- patchright 1.59.1
- playwright-captcha 0.1.4
Full Trace
✗ uv run demo.py
[00:30:38] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/base_solver.py:177} INFO - Cleaning up Click-based Captcha Solver...
[00:30:38] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/base_solver.py:182} INFO - Restored original evaluate method
[00:30:38] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/base_solver.py:186} INFO - Click-based Captcha Solver cleanup completed
Traceback (most recent call last):
File "/home/usr/demo.py", line 107, in <module>
asyncio.run(solve_turnstile())
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/home/usr/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/asyncio/runners.py", line 204, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/home/usr/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/asyncio/runners.py", line 127, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/usr/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/home/usr/demo.py", line 71, in solve_turnstile
await page.goto('https://2captcha.com/demo/cloudflare-turnstile')
File "/home/usr/.venv/lib/python3.14/site-packages/patchright/async_api/_generated.py", line 9160, in goto
await self._impl_obj.goto(
url=url, timeout=timeout, waitUntil=wait_until, referer=referer
)
File "/home/usr/.venv/lib/python3.14/site-packages/patchright/_impl/_page.py", line 533, in goto
return await self._main_frame.goto(**locals_to_params(locals()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/usr/.venv/lib/python3.14/site-packages/patchright/_impl/_frame.py", line 134, in goto
await self._channel.send(
"goto", self._navigation_timeout, locals_to_params(locals())
)
File "/home/usr/.venv/lib/python3.14/site-packages/patchright/_impl/_connection.py", line 52, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/home/usr/.venv/lib/python3.14/site-packages/patchright/_impl/_connection.py", line 500, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
patchright._impl._errors.Error: Page.goto: net::ERR_NAME_NOT_RESOLVED at https://2captcha.com/demo/cloudflare-turnstile
Call log:
- navigating to "https://2captcha.com/demo/cloudflare-turnstile", waiting until "load"
Ah, must be this https://github.com/Kaliiiiiiiiii-Vinyzu/patchright/issues/158?
Reverted to patchright==1.56.0 and the demo example starts.
UPD: page opens, the #cf-turnstile is present, but the .solve_captcha is not finding it. Visually, it apperts as empty
Logs:
[01:14:23] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/base_solver.py:311} INFO - Solving cloudflare_turnstile captcha, attempt 1/3
[01:14:23] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/click/cloudflare/solve_by_click.py:46} INFO - Starting Cloudflare turnstile challenge solving by click...
[01:14:24] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/click/cloudflare/solve_by_click.py:52} INFO - No Cloudflare challenge detected
[01:14:24] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/base_solver.py:177} INFO - Cleaning up Click-based Captcha Solver...
[01:14:24] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/base_solver.py:182} INFO - Restored original evaluate method
[01:14:24] {/home/usr/.venv/lib/python3.14/site-packages/playwright_captcha/solvers/base_solver.py:186} INFO - Click-based Captcha Solver cleanup completed
[01:14:39] {/home/usr/demo.py:100} ERROR - Captcha solving failed: Locator.wait_for: Timeout 10000ms exceeded.
Call log:
- waiting for locator("//p[text()=\"Captcha is passed successfully!\"]") to be visible
- waiting for locator("//p[text()=\"Captcha is passed successfully!\"]")
Hi, thanks for the detailed report! It's now fixed in v0.1.5.
Please upgrade and try again:
pip install --upgrade playwright-captcha
Let me know if it works for you!