Xewdy444 / Playwright-reCAPTCHA

A Python library for solving reCAPTCHA v2 and v3 with Playwright
https://pypi.org/project/playwright-recaptcha/
MIT License
289 stars 39 forks source link

Doesn't work on Chrome #91

Closed LipeTadeu closed 8 months ago

LipeTadeu commented 8 months ago

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.

Xewdy444 commented 8 months ago

What version of Playwright are you using and what website are you using? I tried an example with Chromium and it solved it with no issues:

from playwright.sync_api import sync_playwright
from playwright_recaptcha import recaptchav2

with sync_playwright() as playwright:
    browser = playwright.chromium.launch(headless=False)
    page = browser.new_page()
    page.goto("https://www.google.com/recaptcha/api2/demo")

    with recaptchav2.SyncSolver(page) as solver:
        token = solver.solve_recaptcha(wait=True)
        print(token)
LipeTadeu commented 8 months ago

Hello! All is well?

Here it doesn't really run using Chrome, it only runs if headless=True.

I'm using version playwright==1.33.0

Which one do you run on your machine?

Xewdy444 commented 8 months ago

Try updating Playwright to the latest version with the command: pip install -U playwright and see if this fixes the issue.

LipeTadeu commented 8 months ago

Hello! All is well? Find out what it was, the error was language, I switched the browser to English and it ran perfectly. Thank you very much.

It looked like this:

from playwright.sync_api import sync_playwright from playwright_recaptcha import recaptchav2

with sync_playwright() as playwright: browser = playwright.chromium.launch(headless=False) context = browser.new_context(locale="en-US") page = context.new_page() page.goto("https://www.google.com/recaptcha/api2/demo")

with recaptchav2.SyncSolver(page) as solver:
    token = solver.solve_recaptcha(wait=True)
    print(token)
Xewdy444 commented 8 months ago

Glad to see that you fixed the issue. This library currently supports English and Russian reCAPTCHA, however I could add support for your language as well if you don't mind telling me what it is.

LipeTadeu commented 8 months ago

Hello! Wow, that's great, I don't mind. I'm Brazilian, Brazilian Portuguese. I would appreciate it if you could give me your email, I would like to make you a development proposal.

Xewdy444 commented 8 months ago

Yea sure, my contact information is on my GitHub profile.