Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix: handle error solving captcha

BroskyBrowser516e79c2259d
diff --git a/examples/custom-functions/solve_amazon_captcha.py b/examples/custom-functions/solve_amazon_captcha.py
index 6ddd7ee23..2f69e6f12 100644
--- a/examples/custom-functions/solve_amazon_captcha.py
+++ b/examples/custom-functions/solve_amazon_captcha.py
@@ -43,6 +43,8 @@ async def solve_amazon_captcha(browser_session: BrowserSession):
captcha = AmazonCaptcha.fromlink(link)
solution = captcha.solve()
+ if solution == 'Not solved':
+ raise ValueError("Captcha could not be solved")
await page.locator('#captchacharacters').fill(solution)
await page.locator('button[type="submit"]').click()