Vinyzu / Botright

Botright, the most advance undetected, fingerprint-changing, captcha-solving, open-source automation framework. Build on Playwright, its as easy to use as it is to extend your code. Solving your Captchas for free with AI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Currently I am getting an error after solving recaptcha

bfilipov opened this issue · comments

Describe the bug
After recaptcha is solved successfully I am getting the following exception:

playwright._impl._errors.Error: ReferenceError: grecaptcha is not defined
    at eval (eval at evaluate (:226:30), <anonymous>:1:1)
    at eval (<anonymous>)
    at UtilityScript.evaluate (<anonymous>:226:30)
    at UtilityScript.<anonymous> (<anonymous>:1:44)

Code Sample

botright_client = await botright.Botright()
context = await botright_client.new_browser()
page = await context.new_page()
await page.goto('https://www.google.com')
await page.solve_recaptcha()

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version 20.04

Additional context
Full traceback:

  File "/project_dir/botright_crawler/search_google.py", line 176, in <module>
    asyncio.run(main())
  File "/conda_env/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/conda_env/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/project_dir/botright_crawler/search_google.py", line 56, in main
    await captcha_watch(page)
  File "/project_dir/botright_crawler/search_google.py", line 38, in captcha_watch
    await page.solve_recaptcha()
  File "/conda_env/lib/python3.10/site-packages/botright/playwright_mock/page.py", line 248, in solve_recaptcha
    result: Union[str, bool] = await self.recaptcha_solver.solve_recaptcha()
  File "/conda_env/lib/python3.10/site-packages/recognizer/agents/playwright/async_control.py", line 163, in solve_recaptcha
    return await self.handle_recaptcha()
  File "/conda_env/lib/python3.10/site-packages/recognizer/agents/playwright/async_control.py", line 146, in handle_recaptcha
    return await self.handle_recaptcha()
  File "/conda_env/lib/python3.10/site-packages/recognizer/agents/playwright/async_control.py", line 146, in handle_recaptcha
    return await self.handle_recaptcha()
  File "/conda_env/lib/python3.10/site-packages/recognizer/agents/playwright/async_control.py", line 146, in handle_recaptcha
    return await self.handle_recaptcha()
  [Previous line repeated 2 more times]
  File "/conda_env/lib/python3.10/site-packages/recognizer/agents/playwright/async_control.py", line 138, in handle_recaptcha
    if captcha_token := await self.check_result():
  File "/conda_env/lib/python3.10/site-packages/recognizer/agents/playwright/async_control.py", line 52, in check_result
    captcha_token: str = await self.page.evaluate("grecaptcha.getResponse()")
  File "/conda_env/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 8674, in evaluate
    await self._impl_obj.evaluate(
  File "/conda_env/lib/python3.10/site-packages/playwright/_impl/_page.py", line 391, in evaluate
    return await self._main_frame.evaluate(expression, arg)
  File "/conda_env/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 272, in evaluate
    await self._channel.send(
  File "/conda_env/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 62, in send
    return await self._connection.wrap_api_call(
  File "/conda_env/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 492, in wrap_api_call
    return await cb()
  File "/conda_env/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 100, in inner_send
    result = next(iter(done)).result()
playwright._impl._errors.Error: ReferenceError: grecaptcha is not defined
    at eval (eval at evaluate (:226:30), <anonymous>:1:1)
    at eval (<anonymous>)
    at UtilityScript.evaluate (<anonymous>:226:30)
    at UtilityScript.<anonymous> (<anonymous>:1:44)

environment:

aiodns==3.1.1
aiohttp==3.9.1
aiomisc==17.3.41
aiosignal==1.3.1
annotated-types==0.6.0
anyio==4.2.0
async-class==0.5.0
async-timeout==4.0.3
attrs==22.2.0
Automat==22.10.0
botright==0.5
build==1.0.3
CacheControl==0.13.1
cachetools==5.3.2
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
chrome-fingerprints==1.1
cleo==2.1.0
click==8.1.7
coloredlogs==15.0.1
colorlog==6.8.2
constantly==23.10.4
contourpy==1.2.0
crashtest==0.4.1
cryptography==42.0.2
cssselect==1.2.0
cycler==0.12.1
dacite==1.8.1
distlib==0.3.8
dulwich==0.21.7
exceptiongroup==1.2.0
fake-useragent==1.4.0
fastjsonschema==2.19.1
filelock==3.13.1
flatbuffers==23.5.26
fonttools==4.48.1
frozenlist==1.4.1
fsspec==2024.2.0
ftfy==6.1.3
greenlet==3.0.1
h11==0.14.0
h2==4.1.0
hcaptcha-challenger==0.10.1.post2
hpack==4.0.0
httpcore==1.0.2
httpx==0.26.0
huggingface-hub==0.20.3
humanfriendly==10.0
hyperframe==6.0.1
hyperlink==21.0.0
idna==3.6
imageio==2.33.1
importlib-metadata==7.0.1
incremental==22.10.0
installer==0.7.0
itemadapter==0.8.0
itemloaders==1.1.0
jaraco.classes==3.3.0
jeepney==0.8.0
Jinja2==3.1.3
jmespath==1.0.1
joblib==1.3.2
keyring==24.3.0
kiwisolver==1.4.5
lazy_loader==0.3
logging-journald==0.6.7
loguru==0.7.2
lxml==5.1.0
MarkupSafe==2.1.5
matplotlib==3.8.2
maxminddb==2.5.2
more-itertools==10.2.0
mpmath==1.3.0
msgpack==1.0.7
multidict==6.0.5
networkx==3.2.1
numpy==1.26.4
nvidia-cublas-cu12==12.1.3.1
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cudnn-cu12==8.9.2.26
nvidia-cufft-cu12==11.0.2.54
nvidia-curand-cu12==10.3.2.106
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusparse-cu12==12.1.0.106
nvidia-nccl-cu12==2.19.3
nvidia-nvjitlink-cu12==12.3.101
nvidia-nvtx-cu12==12.1.105
onnxruntime==1.16.1
opencv-python==4.9.0.80
orjson==3.9.13
outcome==1.3.0.post0
packaging==23.2
pandas==2.2.0
parsel==1.8.1
pexpect==4.9.0
pillow==10.2.0
pkginfo==1.9.6
platformdirs==3.11.0
playwright==1.40.0
poetry==1.7.1
poetry-core==1.8.1
poetry-plugin-export==1.6.0
Protego==0.3.0
protobuf==4.25.2
proxybroker @ git+https://github.com/bluet/proxybroker2.git@dc944d6047beb73c281b0f9df238ac5ee1130ac7
psutil==5.9.8
psycopg2-binary==2.9.9
ptyprocess==0.7.0
py-cpuinfo==9.0.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pybrowsers==0.5.2
pycares==4.4.0
pycparser==2.21
pydantic==2.6.1
pydantic_core==2.16.2
PyDispatcher==2.0.7
pyee==11.0.1
pyOpenSSL==24.0.0
pyparsing==3.1.1
pyproject_hooks==1.0.0
PySocks==1.7.1
python-dateutil==2.8.2
python-dotenv==1.0.1
pytz==2024.1
PyWavelets==1.5.0
pyxdg==0.28
PyYAML==6.0.1
queuelib==1.6.2
rapidfuzz==3.6.1
recognizer==1.1
regex==2023.12.25
requests==2.31.0
requests-file==2.0.0
requests-toolbelt==1.0.0
safetensors==0.4.2
scikit-image==0.21.0
scikit-learn==1.4.0
scipy==1.12.0
Scrapy==2.11.0
scrapy-rotating-proxies==0.6.2
seaborn==0.13.2
SecretStorage==3.3.3
selenium==4.17.2
service-identity==24.1.0
shellingham==1.5.4
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
SQLAlchemy==2.0.25
structlog==24.1.0
sympy==1.12
tenacity==8.2.3
thop==0.1.1.post2209072238
threadpoolctl==3.2.0
tifffile==2024.1.30
tldextract==5.1.1
tokenizers==0.15.1
tomli==2.0.1
tomlkit==0.12.3
torch==2.2.0
torchvision==0.17.0
tqdm==4.66.1
transformers==4.37.2
trio==0.24.0
trio-websocket==0.11.1
triton==2.2.0
trove-classifiers==2024.1.31
Twisted==22.10.0
typing==3.7.4.3
typing_extensions==4.9.0
tzdata==2023.4
ultralytics==8.1.10
undetected-chromedriver @ git+https://www.github.com/ultrafunkamsterdam/undetected-chromedriver@783b8393157b578e19e85b04d300fe06efeef653
undetected-playwright-patch==1.40.0.post1700587210000
urllib3==2.2.0
virtualenv==20.25.0
w3lib==2.1.2
wcwidth==0.2.13
websockets==12.0
wsproto==1.2.0
yarl==1.9.4
zipp==3.17.0
zope.interface==6.1

I released reCognizer v1.3 today, which fixes this issue.
It will be implemented in the next update, until then you can upgrade yourself via pip install recognizer --upgrade

Many thanks for fixing it.