What am I doing wrong?
Closed this issue · 6 comments
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()
Hello, there are a couple of things I noticed. First, the reCAPTCHA on the https://crash.chicagopolice.org/DriverInformationExchange/home page is a reCAPTCHA v2, so the recaptchav2.SyncSolver()
will be required to solve it. Another thing I noticed when testing was that the crash date element wasn't being filled properly and always ended up putting a different date. Here is an example that I was able to get working:
from playwright.sync_api import sync_playwright
from playwright_recaptcha import recaptchav2
with sync_playwright() as playwright:
browser = playwright.firefox.launch(headless=False)
page = browser.new_page()
page.goto("https://crash.chicagopolice.org/DriverInformationExchange/home")
page.locator("#rd").fill("JG439031")
# For some reason, calling fill() on the date locator doesn't work properly,
# so this works for now
page.locator("#crashDate").click()
page.keyboard.type("09/25/2023")
page.keyboard.press("Enter")
with recaptchav2.SyncSolver(page) as solver:
solver.solve_recaptcha(wait=True)
with page.expect_navigation(wait_until="networkidle"):
page.get_by_role("button", name="Submit").click()
Thank you for responding. I appreciate it!
One thing that I am still running against is a 'RecaptchaRateLimitError'. I assume that happens because I am trying too often from my computer. I have tried with my IP, and several different proxies, but I get the same result.
Am I still doing something wrong?
Edit:
I tried using firefox and playwright-stealth, but received the same result.
No, you are likely not doing anything wrong. reCAPTCHA just has a pretty strict rate limit for the audio challenge.
Do you know what this limit is? I am using rotating proxies right now, so I'm sure the last few people that had my proxy could have ruined it for me, lol.
If I knew it would work, I wouldn't mind getting a bunch of static proxies and rotating through them.
It depends on many factors and is pretty inconsistent. Yesterday, I was able to solve eight audio challenges in a row. Today, I was only able to solve one before I was rate limited.
I see. Thanks for all your help!