Insurance comparison platforms and carrier quote pages protect their rate engines with CAPTCHAs to prevent automated quote harvesting. CaptchaAI handles these challenges for QA teams testing insurance workflows and comparison aggregators.
CAPTCHA on Insurance Sites
| Carrier Type | CAPTCHA | Trigger Point | Quote Complexity |
|---|---|---|---|
| Auto insurance | reCAPTCHA v2 | Quote form submission | Multi-step (vehicle + driver) |
| Health insurance | reCAPTCHA v2 | Plan comparison | Multi-step (demographics) |
| Home insurance | Image CAPTCHA | Address lookup | Moderate |
| Life insurance | reCAPTCHA v2 | Rate calculator | Simple form |
| Travel insurance | reCAPTCHA v2 Invisible | Quote request | Simple form |
| Business insurance | reCAPTCHA v3 | Contact/quote form | Long form |
Multi-Carrier Quote Collector
import requests
import time
import re
import base64
CAPTCHAAI_KEY = "YOUR_API_KEY"
CAPTCHAAI_URL = "https://ocr.captchaai.com"
def solve_recaptcha(sitekey, pageurl):
resp = requests.post(f"{CAPTCHAAI_URL}/in.php", data={
"key": CAPTCHAAI_KEY, "method": "userrecaptcha",
"googlekey": sitekey, "pageurl": pageurl, "json": 1,
})
task_id = resp.json()["request"]
for _ in range(60):
time.sleep(5)
result = requests.get(f"{CAPTCHAAI_URL}/res.php", params={
"key": CAPTCHAAI_KEY, "action": "get",
"id": task_id, "json": 1,
})
data = result.json()
if data["request"] != "CAPCHA_NOT_READY":
return data["request"]
raise TimeoutError("Timeout")
def solve_image_captcha(image_bytes):
img_b64 = base64.b64encode(image_bytes).decode()
resp = requests.post(f"{CAPTCHAAI_URL}/in.php", data={
"key": CAPTCHAAI_KEY, "method": "base64",
"body": img_b64, "json": 1,
})
task_id = resp.json()["request"]
for _ in range(20):
time.sleep(3)
result = requests.get(f"{CAPTCHAAI_URL}/res.php", params={
"key": CAPTCHAAI_KEY, "action": "get",
"id": task_id, "json": 1,
})
data = result.json()
if data["request"] != "CAPCHA_NOT_READY":
return data["request"]
raise TimeoutError("Timeout")
class InsuranceQuoteCollector:
def __init__(self, proxy=None):
self.session = requests.Session()
if proxy:
self.session.proxies = {"http": proxy, "https": proxy}
self.session.headers.update({
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 Chrome/126.0.0.0 Safari/537.36",
})
def get_auto_quote(self, carrier_url, vehicle_data, driver_data, sitekey):
"""Get auto insurance quote from a single carrier."""
# Step 1: Load quote page
self.session.get(carrier_url)
# Step 2: Submit vehicle info
resp = self.session.post(f"{carrier_url}/vehicle", data=vehicle_data)
# Step 3: Submit driver info
resp = self.session.post(f"{carrier_url}/driver", data=driver_data)
# Step 4: Solve CAPTCHA on quote page
token = solve_recaptcha(sitekey, f"{carrier_url}/quote")
# Step 5: Get quote
resp = self.session.post(f"{carrier_url}/quote", data={
"g-recaptcha-response": token,
})
if resp.status_code == 200:
return self._parse_quote(resp.text)
return None
def compare_carriers(self, carriers, vehicle_data, driver_data):
"""Compare quotes across multiple carriers."""
quotes = []
for carrier in carriers:
try:
quote = self.get_auto_quote(
carrier_url=carrier["url"],
vehicle_data=vehicle_data,
driver_data=driver_data,
sitekey=carrier["sitekey"],
)
quotes.append({
"carrier": carrier["name"],
"status": "success",
"quote": quote,
})
except Exception as e:
quotes.append({
"carrier": carrier["name"],
"status": "failed",
"error": str(e),
})
time.sleep(5) # Delay between carriers
# Sort by price
successful = [q for q in quotes if q["status"] == "success" and q["quote"]]
successful.sort(key=lambda x: x["quote"].get("monthly_premium", float("inf")))
return {
"quotes": quotes,
"best_rate": successful[0] if successful else None,
"total_compared": len(carriers),
"successful": len(successful),
}
def _parse_quote(self, html):
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
premium_el = soup.select_one(".premium, .monthly-rate, .quote-amount")
coverage_el = soup.select_one(".coverage-summary, .plan-details")
return {
"monthly_premium": premium_el.get_text(strip=True) if premium_el else "",
"coverage": coverage_el.get_text(strip=True) if coverage_el else "",
}
# Usage
collector = InsuranceQuoteCollector(
proxy="http://user-session-abc:pass@residential.proxy.com:5000"
)
vehicle = {
"year": "2022",
"make": "Toyota",
"model": "Camry",
"vin": "",
"mileage": "15000",
}
driver = {
"age": "35",
"gender": "M",
"zip": "90210",
"driving_record": "clean",
}
carriers = [
{"name": "Carrier A", "url": "https://carrier-a.example.com/auto", "sitekey": "6Lc_xxx1"},
{"name": "Carrier B", "url": "https://carrier-b.example.com/auto", "sitekey": "6Lc_xxx2"},
{"name": "Carrier C", "url": "https://carrier-c.example.com/auto", "sitekey": "6Lc_xxx3"},
]
comparison = collector.compare_carriers(carriers, vehicle, driver)
print(f"Best rate: {comparison['best_rate']}")
Health Insurance Plan Comparison
def compare_health_plans(marketplace_url, demographics, sitekey):
"""Compare health insurance plans on marketplace sites."""
collector = InsuranceQuoteCollector(
proxy="http://user-session-xyz:pass@residential.proxy.com:5000"
)
# Load marketplace
collector.session.get(marketplace_url)
# Submit demographics
collector.session.post(f"{marketplace_url}/demographics", data=demographics)
# Solve CAPTCHA for plan results
token = solve_recaptcha(sitekey, f"{marketplace_url}/plans")
resp = collector.session.post(f"{marketplace_url}/plans", data={
"g-recaptcha-response": token,
})
if resp.status_code == 200:
from bs4 import BeautifulSoup
soup = BeautifulSoup(resp.text, "html.parser")
plans = []
for card in soup.select(".plan-card, .insurance-plan"):
plans.append({
"name": card.select_one(".plan-name").get_text(strip=True) if card.select_one(".plan-name") else "",
"premium": card.select_one(".premium").get_text(strip=True) if card.select_one(".premium") else "",
"deductible": card.select_one(".deductible").get_text(strip=True) if card.select_one(".deductible") else "",
})
return plans
return []
Session Requirements
Insurance quoting is always multi-step — sticky sessions are mandatory:
| Step | Data Submitted | IP Requirement |
|---|---|---|
| 1. Personal info | Name, DOB, zip | Same IP |
| 2. Vehicle/property | Year, make, model | Same IP |
| 3. Coverage selection | Limits, deductible | Same IP |
| 4. CAPTCHA solve | Token | Same IP |
| 5. Quote display | N/A | Same IP |
Use sticky proxy sessions with 10-15 minute TTL for insurance flows.
Troubleshooting
| Issue | Cause | Fix |
|---|---|---|
| Quote form resets mid-flow | IP changed between steps | Use sticky proxy session |
| "Unable to provide quote" | Data validation failed | Check required fields |
| CAPTCHA appears twice | First token expired | Solve again immediately |
| Different rates than manual | Cookie/session differences | Start clean session |
| Rate limiter blocks requests | Too many quotes from IP | Slow down, rotate IP between carriers |
FAQ
How many quotes can I collect per day?
Typically 20-50 per carrier per day with proper delays. Exceeding this triggers rate limiters and CAPTCHAs more aggressively.
Why do I need sticky sessions for insurance?
Insurance quote workflows are multi-step. The server links each step to your session and IP. Changing IP mid-flow invalidates the session.
Can I automate across multiple insurance verticals?
Yes. The same CAPTCHA handling approach works for auto, health, home, and life insurance — only the form fields differ.
Related Guides
Compare insurance quotes at scale — get your CaptchaAI key and automate the quoting process.
Discussions (0)
Join the conversation
Sign in to share your opinion.
Sign InNo comments yet.