Was this helpful?
How to bypass reCAPTCHA v2 Enterprise on LexisNexis
Technical engineer
The LexisNexis Risk Solutions website (buycrash.lexisnexisrisk.com) is a professional data search platform that uses advanced reCAPTCHA v2 Enterprise protection to block automated requests to the login form.
Working with this captcha has several important technical features. First, the captcha widget does not load with the page: it appears dynamically only after the user clicks the Sign In button and interacts with the authorization form. Second, the corporate version of reCAPTCHA (Enterprise) has stricter verification algorithms. Third, and most importantly, modern implementations of this protection often ignore tokens that were simply placed in hidden form fields. The site expects the widget itself to report successful validation by calling a special JavaScript function (callback).
In this guide, we will break down step by step how to wait for the dynamic captcha to appear, extract the necessary parameters, send the task for solving via the modern API v2, and, most importantly, correctly inject the received token through the callback mechanism so that the site reliably accepts the solution.
Task Parameters (API v2)
To send a task via the modern API v2, the createTask endpoint is used. The task object must contain the following parameters in strict accordance with the documentation:
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | Task type: RecaptchaV2EnterpriseTaskProxyless |
| websiteURL | String | Yes | The full URL of the target web page where the captcha is loaded |
| websiteKey | String | Yes | reCAPTCHA site key. Can be found in the data-sitekey property of the div element |
| enterprisePayload | Object | No | Additional parameters that may be required for Enterprise reCAPTCHA (e.g., {"s": "..."}) |
| apiDomain | String | No | The domain from which the reCAPTCHA script is loaded. By default www.google.com, but may be www.recaptcha.net |
| isInvisible | Boolean | No | Indicates whether the reCAPTCHA is invisible |
| data | String | No | Additional payload data |
| cookies | String | No | Cookies that will be passed to the task |
How to find parameters
Parameters for reCAPTCHA v2 Enterprise are static, but they can only be extracted after the captcha appears in the page's DOM tree.
- Open the website https://buycrash.lexisnexisrisk.com/ui/home in your browser.
- Click the Sign In button. Wait for the modal window or form with login and password fields to open, and for the captcha widget to appear.
- Press F12 to open Developer Tools (DevTools) and go to the Elements tab.
- Press Ctrl+F (or Cmd+F) and search for g-recaptcha or data-sitekey.
- You will find a div element similar to this:
- The value of the data-sitekey attribute is your websiteKey.
- Copy the full URL from the browser's address bar. This will be your websiteURL.
Code Examples
Python + requests (API v2)
Example of sending a task and polling for the result using the requests library via API v2 endpoints.
python
import requests
import time
API_KEY = 'YOUR_API_KEY'
WEBSITE_URL = 'https://buycrash.lexisnexisrisk.com/ui/home'
WEBSITE_KEY = '6LcguussAAAAAJSH4sc2q8R_DnOSO-5qUXfLWjoE'
# 1. Create task via API v2
url = 'https://api.2captcha.com/createTask'
headers = {
'Content-Type': 'application/json'
}
payload = {
"clientKey": API_KEY,
"task": {
"type": "RecaptchaV2EnterpriseTaskProxyless",
"websiteURL": WEBSITE_URL,
"websiteKey": WEBSITE_KEY
}
}
response = requests.post(url, headers=headers, json=payload)
result = response.json()
if result.get('errorId') == 0:
task_id = result.get('taskId')
print(f"Task created, ID: {task_id}")
# 2. Get result via API v2
res_url = 'https://api.2captcha.com/getTaskResult'
while True:
time.sleep(5) # Pause between requests
res_payload = {
"clientKey": API_KEY,
"taskId": task_id
}
res_response = requests.post(res_url, headers=headers, json=res_payload).json()
if res_response.get('errorId') == 0 and res_response.get('status') == 'ready':
print("Captcha solved successfully!")
token = res_response['solution']['gRecaptchaResponse']
print(f"Token: {token}")
break
elif res_response.get('errorId') != 0:
print(f"Error: {res_response.get('errorDescription')}")
break
else:
# Status processing - task is not ready yet
continue
else:
print(f"Task creation error: {result.get('errorDescription')}")
Python + Playwright
Example of automation that opens the page, clicks the login button for dynamic captcha loading, extracts the sitekey, sends the task via API v2, and injects the token via callback.
python
from playwright.sync_api import sync_playwright
import requests
import time
API_KEY = 'YOUR_API_KEY'
TARGET_URL = 'https://buycrash.lexisnexisrisk.com/ui/home'
def solve_lexisnexis_recaptcha_v2():
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
page = browser.new_page()
try:
page.goto(TARGET_URL)
# 1. Click the Sign In button to reveal the form and captcha
# The selector may vary, check the actual class or ID on the site
page.click('button:has-text("Sign In")')
# Wait for the reCAPTCHA widget to appear in the DOM
page.wait_for_selector('.g-recaptcha', timeout=10000)
# 2. Extract sitekey from the data-sitekey attribute
site_key = page.evaluate("""
() => {
const captchaDiv = document.querySelector('.g-recaptcha');
return captchaDiv ? captchaDiv.getAttribute('data-sitekey') : null;
}
""")
if not site_key:
raise Exception("Failed to find reCAPTCHA sitekey on the page.")
print(f"Found sitekey: {site_key}")
# 3. Send to API v2
api_url = 'https://api.2captcha.com/createTask'
headers = {'Content-Type': 'application/json'}
payload = {
"clientKey": API_KEY,
"task": {
"type": "RecaptchaV2EnterpriseTaskProxyless",
"websiteURL": page.url,
"websiteKey": site_key
}
}
task_response = requests.post(api_url, headers=headers, json=payload).json()
if task_response.get('errorId') != 0:
raise Exception(f"Task creation error: {task_response.get('errorDescription')}")
task_id = task_response.get('taskId')
# 4. Wait for solution via getTaskResult
res_url = 'https://api.2captcha.com/getTaskResult'
token = None
for _ in range(20):
time.sleep(5)
res = requests.post(res_url, headers=headers, json={"clientKey": API_KEY, "taskId": task_id}).json()
if res.get('status') == 'ready':
token = res['solution']['gRecaptchaResponse']
break
if res.get('errorId') != 0:
print(f"API error: {res.get('errorDescription')}")
break
if token:
print(f"Token received: {token}")
# 5. Inject token via callback
page.evaluate(f"""
// Attempt to find and call the named callback (replace 'yourCallbackName' with the real one if it is specified in data-callback)
if (typeof yourCallbackName === 'function') {{
yourCallbackName("{token}");
}}
// Alternative universal injection method via internal grecaptcha structure
const textarea = document.querySelector('textarea[name="g-recaptcha-response"]');
if (textarea) {{
textarea.value = "{token}";
textarea.dispatchEvent(new Event('change', {{ bubbles: true }}));
}}
console.log("Token injection attempted");
""")
print("Token passed via callback/DOM.")
else:
print("Failed to get token.")
except Exception as e:
print(f"Error: {e}")
finally:
# browser.close()
if __name__ == '__main__':
solve_lexisnexis_recaptcha_v2()
How to use the received token (Passing via callback)
The LexisNexis website, like many other corporate platforms with reCAPTCHA v2 Enterprise, may completely ignore the token if it was simply written to a hidden form field. The protection architecture expects the widget itself to initiate the successful validation event.
To implement this correctly:
- Examine the page source code (Elements tab). Find the div with the class g-recaptcha.
- Check if it has a data-callback="function_name" attribute. If it is present, this is the most reliable path. Simply call this function via page.evaluate, passing it the token: function_name("YOUR_TOKEN").
- If there is no data-callback attribute, use the universal injection method via the internal ___grecaptcha_cfg structure or change event emulation, which is described in detail in our specialized article: How to pass reCAPTCHA v2 token via callback (https://2captcha.com/h/recaptcha-v2-callback).
Common Errors and Solutions (API v2)
| Error / Problem | Cause | Solution |
|---|---|---|
| ERROR_KEY_DOES_NOT_EXIST | Invalid or empty API key. | Check that the key is copied correctly from the dashboard. |
| ERROR_ZERO_BALANCE | Insufficient funds in the account. | Top up your account balance. |
| ERROR_INVALID_PARAMETERS | Missing required parameters (e.g., websiteKey or websiteURL) or invalid JSON format. | Ensure the task object contains all necessary fields in the correct format as specified in the API v2 documentation. |
| ERROR_GOOGLEKEY | Invalid websiteKey format or domain mismatch. | Ensure the key starts with 6L, is copied without extra spaces, and the websiteURL exactly matches the domain the key is registered for. |
| ERROR_CAPTCHA_UNSOLVABLE | The captcha cannot be solved (token expired or strict Enterprise settings). | Reload the page, get a new sitekey, and send the task again without long delays. |
| Token not accepted by the form | Incorrect injection method (site expects a callback). | Do not rely solely on hidden fields. Find the callback function in the source code or use the method from the callback article. |
Useful Links
- API testing sandbox: https://2captcha.com/setting#sandbox
- reCAPTCHA v2 Enterprise API documentation: https://2captcha.com/api-docs/recaptcha-v2-enterprise
- API v2 Error Codes list: https://2captcha.com/api-docs/error-codes
- Article: How to pass reCAPTCHA v2 token via callback: https://2captcha.com/h/recaptcha-v2-callback
- Python SDK on GitHub: https://github.com/2captcha/2captcha-python
- Other examples of bypassing captchas on websites: https://2captcha.com/h?category=sites