Giter VIP home page Giter VIP logo

playwright-recaptcha's Introduction

Hi there πŸ‘‹

  • πŸ‘€ I’m interested in the internet, computers, programming, cybersecurity, and gaming
  • 🌱 I’m currently learning HTML and CSS
  • πŸ’¬ Ask me about Python
  • ⚑ Fun fact: My favorite animals are cats and guinea pigs
  • πŸ“« You can reach me via Discord @ Xewdy#7378 or via email @ [email protected]

playwright-recaptcha's People

Contributors

alexreg avatar deepsource-autofix[bot] avatar deepsourcebot avatar dependabot[bot] avatar sirfilippov avatar xewdy444 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

playwright-recaptcha's Issues

How to Use

I'm just a newbie but looking to use this with GSA CaptchaBreaker in some way.
How do I even test this with a URL?
Can you help with examples of how to run? Ideally, I'd like to run this inside a Docker container and send requests to it via GSA CB

Any help would be fantastic

Hcaptcha?

Are you looking to incorporate solving HCaptcha at any time?

Google login captchas solving

Hey and first of all good job on trying to solve those captcha problems.
I tried both recaptchav2 and recaptchav3 for the google login flow and none worked.
Any ideas how to solve this one?
Thank you!
image

The api request looks like this:
https://accounts.google.com/Captcha?v=2&ctoken=AAWk9lQmxc2mqQGWcUrhHHacb8fogK0R6wGYLty5tKC0srS_mLrKbxQCIW6WykE9gU7k49WRaU4XC1R2X2MuYXVler7crvY0C5BKSs-tG3pMLDmm8ebjRTMmG2aoSSqmzZ6ANjjqBfg9HRl_FG8h9E8HAmcjoeH-IT8FGqHixezooAjx83PSBTCzhgFM-2o35xdTuMc1qGUB&kind=audio

Bug: AudioSegment.from_mp3(mp3_audio) in Mac (Solved)

Hello

I was receiving the following error when trying to solve captcha by audio in Macos (I leave the solution in case someone else gets the same error):

Traceback (most recent call last):
  File "/Users/jxlil/captcha/test.py", line 10, in <module>
    token = solver.solve_recaptcha(wait=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jxlil/captcha/.venv/lib/python3.11/site-packages/playwright_recaptcha/recaptchav2/sync_solver.py", line 606, in solve_recaptcha
    self._solve_audio_challenge(recaptcha_box)
  File "/Users/jxlil/captcha/.venv/lib/python3.11/site-packages/playwright_recaptcha/recaptchav2/sync_solver.py", line 464, in _solve_audio_challenge
    text = self._convert_audio_to_text(url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jxlil/captcha/.venv/lib/python3.11/site-packages/playwright_recaptcha/recaptchav2/sync_solver.py", line 274, in _convert_audio_to_text
    audio = AudioSegment.from_mp3(mp3_audio)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jxlil/captcha/.venv/lib/python3.11/site-packages/pydub/audio_segment.py", line 796, in from_mp3
    return cls.from_file(file, 'mp3', parameters=parameters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jxlil/captcha/.venv/lib/python3.11/site-packages/pydub/audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jxlil/captcha/.venv/lib/python3.11/site-packages/pydub/utils.py", line 279, in mediainfo_json
    info = json.loads(output)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Future exception was never retrieved
future: <Future finished exception=Error('Connection closed')>
playwright._impl._api_types.Error: Connection closed

The error is generated in the pydub (pydub/utils.py) library, in this part:

def mediainfo_json(filepath, read_ahead_limit=-1):
    ...
    command = [prober, '-of', 'json'] + command_args
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
    output, stderr = res.communicate(input=stdin_data)
    output = output.decode("utf-8", 'ignore')
    stderr = stderr.decode("utf-8", 'ignore')

    --> info = json.loads(output)

This is because output is an empty string and it is supposed to be a JSON formatted string.


Solution

Although the problem seems to be in one of the libraries, in my case it was due to ffmpeg. Reinstalling it as follows solved the problem:

brew uninstall librist --ignore-dependencies
brew uninstall mbedtls --ignore-dependencies
brew reinstall ffmpeg

I made a mistake somewhere...

I can't solve the captcha. The page at the URL opens, but nothing happens ((

`
from playwright.sync_api import sync_playwright
from playwright_recaptcha import recaptchav3
import time
#import re

with sync_playwright() as playwright:
browser = playwright.firefox.launch(headless=False)
page = browser.new_page()
page.goto("https://visa.vfsglobal.com/us/en/fra/login")
time.sleep(10)

with recaptchav3.SyncSolver(page) as solver:
    page.frame_locator('iframe[title="reCAPTCHA"]').get_by_role("checkbox").click()
    token = solver.solve_recaptcha()
    print(token)
    page.evaluate('document.getElementById("g-recaptcha-response").innerHTML="token";', token)

`

Recaptcha rate limit and headless issue

Trying this out and have a couple issues Im hoping I can get assistance with.

In headless mode it never seems to work, I get an error that that recaptcha limit has been exceeded. It will generally work in headed mode however. I am using the chromium browser and this does not seem to be an issue when using this with FireFox. Also, this is on a site OTHER than the demo google site.

any advice?

Thanks!

Doesn't work on Chrome

Hi, how are you?
Do you know why it doesn't run in Chrome when we use headless=False?

example:

with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=False)

He opens the browser but does not resolve recaptcha and does not even click on recaptcha.

That doesn't work either.

with sync_playwright() as playwright:
browser = playwright.chromium.launch(channel='chrome',headless=False)

only works in Firefox.

Thank.

Make checkbox optional

Hey! Thanks for providing this solution :) Really nicely designed.

I happen to run into a scenario where there is no checkbox with "I'm not a robot", but the recaptcha gets invoked on a button click (I assume).

playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for get_by_role("checkbox", name="I'm not a robot")

Would that make sense to make this click event optional?

This is the moment it runs into the timeout:

image

Recaptcha Enterprise

Hello,

Thank you for your help last time on #65 I just saw it.

I have an issue with Recaptcha Enterprise where the captcha fails to get resolved but I don't know if I'm doing it wrong or if it's just how it is ?

I read #61 and tried to do the same but no luck. (Note that "https://www.myfitnesspal.com/user/search" redirects to "https://www.myfitnesspal.com/account/login", I use it so when I fill credentials it redirects me directly to the page I want.

The cookie loading is just I don't have the modal asking me to accept the cookies because for some reasons I had issues clicking the yes button.

Here is screenshot of failed captcha :
fX6B4dO

Also note that at first it used to work(without stealth_sync that you see I added that later to see if it would make a difference), but I don't know if it worked because of I did the solving with your library properly or because recaptcha just decided it would make me pass no matter what

Here is script (it fails at page.wait_for_selector('[href="/profile/myusernamehere"]', timeout=7000) ):

def get_html_results(email):
	# Define the URL
	display = Display(visible=0, size=(800, 600))
	display.start()
	url = "https://www.myfitnesspal.com/user/search"
	with sync_playwright() as p:
		browser = p.firefox.launch()
		
		context = browser.new_context(locale='en-US')
		with open("myfitnesspal_cookies.json", "r") as f:
			cookies = json.loads(f.read())
			context.add_cookies(cookies)

		page = context.new_page()
		stealth_sync(page)
		page.route(
			"https://www.myfitnesspal.com/account/login",
			lambda route: route.abort()
			if route.request.method == "POST"
			else route.continue_(),
		)
		page.goto(url)


		page.wait_for_selector("input[id='email']", timeout=5000).fill("[email protected]")
		page.fill('input[id="password"]', 'mypassword')
		page.select_option('select[aria-label="language-selector"]', "en")
		with recaptchav3.SyncSolver(page) as solver:
			page.click('.MuiButtonBase-root.MuiButton-root.MuiButton-contained.MuiButton-containedPrimary.MuiButton-sizeMedium')
			token = solver.solve_recaptcha()
		try:
			page.wait_for_selector('[href="/profile/myusernamehere"]', timeout=7000)
		except Exception as e:
			page.screenshot(path='screenshot0.png')
			display.stop()
			raise e
		# Wait for the iframe to appear
		# Wait for the email field to be visible and interact with it

		page.screenshot(path='screenshot0.png')
		page.wait_for_selector("[id='username_or_email']", timeout=5000).fill(email)
		page.screenshot(path='screenshot1.png')
		page.wait_for_selector("input[type='submit'][name='commit'][data-disable-with]", timeout=5000)
		page.evaluate("document.querySelector('form[method=\"post\"]').submit()")
		time.sleep(2)
		page.screenshot(path='screenshot1.png')
		html = page.content()
		browser.close()
		display.stop()
		return html

Thank you !

retry / solve challenge on recaptcha expiration

sometimes the recaptcha expires or needs to be solved again

<div class="rc-anchor-error-msg-container" style=""><span class="rc-anchor-error-msg" aria-hidden="true">Verification challenge expired. Check the checkbox again.</span></div>

here is what ie container message looks like.
could you add support for this? thanks.

Error: Frame was detached

First, thanks for this very handy library.

There seems to be a sporadic bug that occurs because the captcha submits successfully and the page navigates away (removing the frame) before the solver_recaptcha method finishes. Here's the backtrace.

Traceback (most recent call last):
  File "/opt/homebrew/bin/familysearch-downloader", line 8, in <module>
    sys.exit(app())
  File "/Users/alex/Software/typer/typer_cloup/main.py", line 327, in __call__
    return get_command(self)(*args, **kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/alex/Software/typer/typer_cloup/main.py", line 720, in wrapper
    return callback(**use_params)  # type: ignore
  File "/Users/alex/Software/familysearch-downloader/familysearch_downloader/main.py", line 102, in main
    downloader.login()
  File "/Users/alex/Software/familysearch-downloader/familysearch_downloader/downloader.py", line 71, in login
    token = solver.solve_recaptcha()
  File "/opt/homebrew/lib/python3.10/site-packages/playwright_recaptcha/recaptchav2/sync_solver.py", line 236, in solve_recaptcha
    self._submit_audio_text(recaptcha_frame, recaptcha_checkbox, text)
  File "/opt/homebrew/lib/python3.10/site-packages/playwright_recaptcha/recaptchav2/sync_solver.py", line 184, in _submit_audio_text
    ).is_visible()
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 16322, in is_visible
    self._sync(self._impl_obj.is_visible(timeout=timeout))
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 104, in _sync
    return task.result()
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 450, in is_visible
    return await self._frame.is_visible(
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 353, in is_visible
    return await self._channel.send("isVisible", locals_to_params(locals()))
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 44, in send
    return await self._connection.wrap_api_call(
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 419, in wrap_api_call
    return await cb()
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 79, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.Error: Frame was detached

No unchecked reCAPTCHA boxes were found

Hey, I'm trying to bypass the reCAPTCHA of this web page but I feel like I'm not using your library properly and it says no unchecked reCAPTCHA boxes were found.
In the source code it says data-version="v2_invisible" for the captcha element, maybe it's because it's invisible that the library can't find it ?

But I saw your comment here : #6 (comment) and in my script I do click the button before trying to solve the captcha

def scrape_whoxy(email, retry_count=7):
	for attempt in range(retry_count):
		try:
			with sync_playwright() as p:
				user_agents = [
					"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
					"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15",
					"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
					"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
					"Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1",
					"Mozilla/5.0 (iPad; CPU OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1",
					"Mozilla/5.0 (Linux; Android 11; Pixel 3 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36",
					"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.100.0",
					"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
					"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0"
				]
				# proxy = random.choice(PROXIES)
				# proxy_settings = {
				# 	"server": f"socks5://{proxy}",
				# 	# Uncomment and fill these if your proxy requires authentication
				# 	# "username": "your-username",
				# 	# "password": "your-password"
				# }
				browser = p.chromium.launch(headless=False)  # Non-headless browser
				context = browser.new_context(user_agent=random.choice(user_agents))
				
				# Add other stealth techniques here
				page = context.new_page()
				stealth_sync(page)
				page.goto("https://www.whoxy.com/reverse-whois/demo.php")
				page.wait_for_selector('[name="search_identifier"]')
				pyperclip.copy(page.content())
				page.select_option('select[name="search_identifier"]', 'email')
				page.fill('input#search_keyword', email)
				page.evaluate("document.querySelector('#result_mode').selectedIndex = 0")
				time.sleep(0.2)
				page.click('.g-recaptcha.btn_1')
				with recaptchav2.SyncSolver(page) as solver:
					token = solver.solve_recaptcha(wait=True)
					print(token)

				tt = time.time()
				try:
					page.wait_for_selector("pre", timeout=1000)
				except Exception as e:
					page.screenshot(path="scrapie_error.png")
					raise e
				print(time.time() - tt)
				page.screenshot(path="scrapie_success.png")
				json_string = re.search(r'<pre.*?>(.*?)</pre>', page.content(), re.DOTALL).group(1)
				json_data = json.loads(json_string)
				browser.close()
				return parse_whoxy(json_data, email)
		except Exception as e:
			print(f"Attempt {attempt + 1} failed in scrape_whoxy: {e}")
			# Optionally, add a delay here before retrying

	print("All attempts failed in scrape_whoxy")
	return None

add language PR

I can add another language (tested on audio messages), but I don't know the best way to add a language selection feature.
I saw a PR with adding Korean (#43), but it was rejected for some reason. Maybe the author can tell me how he wants to implement multi-language?

Hello Sir)

Can you help me pls. How can use it on my Google Chrome (PC) with Tampermonkey (User Script)??? How integrated it ..?!

Can't catch an exception while solving reCaptcha v3

Hi!

Could you please help me solve a playwright._impl._api_types.Error: Protocol error exception while using AsyncSolver?
The issue is that I can't seem to catch it with try... except clause and as a result can't handle it properly. I would like to restart the browser or reload page on an exception.

Is this a Playwright-reCAPTCHA issue or a more general playwright error?

Exception in callback AsyncIOEventEmitter._emit_run.<locals>.callback(<Task finishe...js:118:20\n')>) at /Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/pyee/
asyncio.py:65                                                                                                                                                                 
handle: <Handle AsyncIOEventEmitter._emit_run.<locals>.callback(<Task finishe...js:118:20\n')>) at /Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/pyee/asynci
o.py:65>                                                                                                                                                                      
Traceback (most recent call last):                                                                                                                                            
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/pyee/asyncio.py", line 71, in callback
    self.emit("error", exc)
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/pyee/base.py", line 179, in emit
    self._emit_handle_potential_error(event, args[0] if args else None)
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/pyee/base.py", line 139, in _emit_handle_potential_error
    raise error
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/playwright_recaptcha/recaptchav3/async_solver.py", line 52, in _extract_token
    token_match = re.search('"rresp","(.*?)"', await response.text())
                                               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/playwright/async_api/_generated.py", line 603, in text
    return mapping.from_maybe_impl(await self._impl_obj.text())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/playwright/_impl/_network.py", line 564, in text
    content = await self.body()
              ^^^^^^^^^^^^^^^^^
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/playwright/_impl/_network.py", line 560, in body
    binary = await self._channel.send("body")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 61, in send
    return await self._connection.wrap_api_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 482, in wrap_api_call
    return await cb()
           ^^^^^^^^^^
  File "/Users/user/.pyenv/versions/3.11.5/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 97, in inner_send
    result = next(iter(done)).result()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
playwright._impl._api_types.Error: Protocol error (Network.getResponseBody): Request "7518340251688" is not found getBase64EncodedResponse@chrome://juggler/content/NetworkObs
erver.js:826:13
getResponseBody@chrome://juggler/content/NetworkObserver.js:92:34
Network.getResponseBody@chrome://juggler/content/protocol/PageHandler.js:261:30
dispatch@chrome://juggler/content/protocol/Dispatcher.js:132:39
_dispatch@chrome://juggler/content/protocol/Dispatcher.js:69:36
receiveMessage@chrome://juggler/content/components/Juggler.js:118:20

problem with greenlet on Win10

trying to get the test script to run on Windows 10 but getting an error with greenlet

C:\Users\rasta\Documents>python solve_capv3.py Traceback (most recent call last): File "C:\Users\rasta\Documents\solve_capv3.py", line 2, in <module> from playwright_recaptcha import recaptchav3 File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright_recaptcha\__init__.py", line 10, in <module> from playwright_recaptcha.recaptchav2.async_solver import AsyncSolver as AsyncSolverV2 File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright_recaptcha\recaptchav2\__init__.py", line 2, in <module> from playwright_recaptcha.recaptchav2.async_solver import AsyncSolver File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright_recaptcha\recaptchav2\async_solver.py", line 14, in <module> from playwright.async_api import Page, Response File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright\async_api\__init__.py", line 25, in <module> import playwright.async_api._generated File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright\async_api\_generated.py", line 25, in <module> from playwright._impl._accessibility import Accessibility as AccessibilityImpl File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright\_impl\_accessibility.py", line 17, in <module> from playwright._impl._connection import Channel File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\playwright\_impl\_connection.py", line 23, in <module> from greenlet import greenlet File "C:\Users\rasta\AppData\Local\Programs\Python\Python311\Lib\site-packages\greenlet\__init__.py", line 29, in <module> from ._greenlet import _C_API # pylint:disable=no-name-in-module ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ImportError: DLL load failed while importing _greenlet: The specified module could not be found.

For the life of me, I can't see why there's an issue. This is a fresh Python 3.11.2 install. all the dependencies look correct including greenlet 2.0.1

Has this been tested on Windows 10 by anyone?

How to solve when the reCaptcha (v2) is within an iFrame?

Getting "playwright_recaptcha.errors.RecaptchaNotFoundError: The reCAPTCHA was not found." due to the reCaptcha being inside of an iFrame.

Tried to solve this issue by passing the iframe context instead of the page context into the SyncSolver function such that

captcha_iframe = await page.query_selector('iframe[title="reCAPTCHA"]')
if captcha_iframe:
     frame = await captcha_iframe.content_frame()
     recaptchav2.SyncSolver(page=frame, capsolver_api_key="CAP-123") as solver:
          token = solver.solve_recaptcha(wait=True, image_challenge=True)
          print(token)

but run into the error 'Permission denied to access property "docShell" on cross-origin object'.

Has anyone had similar issues?

Request timed out after

=========================== logs ===========================
β†’ POST https://api.capsolver.com/createTask
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0
accept: /
accept-encoding: gzip,deflate,br
content-type: application/json
content-length: 52577

Can slow v2 down? how?

"An exception raised when the reCAPTCHA rate limit has been reached. This can happen if the library is being used to solve reCAPTCHA v2 too quickly."

This seems to happen more often than not in my newbie testing.
Is there some way to slow things down to get the solver to work?
This even happens for me using https://www.google.com/recaptcha/api2/demo as the target

What am I doing wrong?

I can't figure it out. I have tried a million different things, but not the right things... I don't understand what I am doing wrong here.

from playwright.sync_api import sync_playwright
from playwright_recaptcha import recaptchav3


with sync_playwright() as playwright:
    browser = playwright.firefox.launch(headless=False)
    page = browser.new_page()

    with recaptchav3.SyncSolver(page) as solver:
        page.goto("https://crash.chicagopolice.org/DriverInformationExchange/home")
        page.frame_locator('iframe[title="reCAPTCHA"]').get_by_label("I'm not a robot").click()
        token = solver.solve_recaptcha()
        print(token)
        page.evaluate('document.getElementById("g-recaptcha-response").innerHTML="token";', token)

        page.locator("//input[@id='crashDate']").fill("09/25/2023")
        page.locator("//input[@id='rd']").fill("JG439031")
        page.get_by_role("button", name="Submit").click()

No such file or directory: 'ffprobe'

Hello.

I am trying to run the code, for passing recaptcha v2.
But I am receiving this kind of error.
I have ffmpeg and ffprobe files near, and I have already installed ffmpeg using brew, but anyway I got this error message.
Can you help me to solve this problem?

Thank you.
image

How to work through a proxy?

I think that after several requests Google will block the IP, is there a way to make requests for a solution through a proxy? To avoid being blacklisted
Any ideas?
Thank you

How to work through a proxy correctly?

I have already asked a similar question, but I don’t fully understand how to do this correctly.
for example I have the code

from playwright.sync_api import sync_playwright
from playwright_recaptcha import recaptchav2
from playwright_recaptcha import recaptchav3
proxy = 'https://222.222.222.222:000'
with sync_playwright() as playwright:
    browser = playwright.firefox.launch(
        proxy={
            'server': f'{proxy}'
        }
   )
  page = browser.new_page()
  page.goto(url)

 with recaptchav2.SyncSolver(page) as solver:
     token = solver.solve_recaptcha(wait=True)
     return f'token = "{token}"'

but Google always talks about limits,
proxies are constantly changing, but I have the impression that captcha recognition does not go through a proxy. I conclude that I am not connecting to the proxy correctly.
I tried

proxy={
    'server': f'{proxy}'
}

and

proxy={
    'http': f'{proxy}'
}

and

proxy={
    'https': f'{proxy}'
}

Please show me how to do it right
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.