"""Captcha Resolver for v2"""
def captcharesolver(driver):
solver = TwoCaptcha(MY_API_KEY)
try:
result = solver.recaptcha(
sitekey=SITE_KEY,
url=SITE_URL)
except Exception as e:
sys.exit(e)
else:
response_site = requests.get(SITE_URL)
# Requesting RECAPTCHA ID
response = requests.get(REQUEST_URL, params= {
"key": os.environ.get("API_KEY"),
"method": "userrecaptcha",
"googlekey": SITE_KEY,
"pageurl": SITE_URL
})
# Getting the token
token_from_captcha = response.text.split("|")[1]
time.sleep(15)
# Get the Captcha solver
while True:
time.sleep(10)
full_request_solution = requests.get(RESPONSE_URL, params={
'key': MY_API_KEY,
'action': 'get',
'id':token_from_captcha
})
if full_request_solution.text[0:2] == 'OK':
break
captcha_results = full_request_solution.text[3:]
final_req = full_request_solution.text
final_request_solution = final_req.split("|")[1]
element = driver.find_element(By.TAG_NAME,'textarea')
driver.execute_script("arguments[0].setAttribute('style', 'display: true')", element)
driver.execute_script("""document.querySelector('[name="g-recaptcha-response"]').innerText='{}'""".format(final_request_solution))
This is the error message I am getting
DevTools listening on ws://127.0.0.1:53085/devtools/browser/93c9ca46-e237-43b6-8d19-ba484fe0da06 Traceback (most recent call last): File "e:\ReverseLookup\main.py", line 45, in captcharesolver(driver) File "e:\ReverseLookup\recaptcha_new.py", line 68, in captcharesolver element = driver.find_element(By.TAG_NAME,'textarea') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Vivek D\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 831, in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"tag name","selector":"textarea"} (Session info: chrome=114.0.5735.110)
I tried to locate the element by all possible ways but its still not working. I have also referred to this: Thread