I want to solve hCaptcha-invisible.
→https://2captcha.com/demo/hcaptcha-invisible
I successfully solved other hCaptcha.
For example hCaptcha-difficult.
→https://2captcha.com/demo/hcaptcha?difficulty=difficult
But I can't solve hCaptcha-invisible.
My program code is almost same. The differences as only parameter of 'pageurl' and 'sitekey'.
Problem
In case hCaptcha-difficult, When I submit, it showed 'Success!' But in case hCaptcha-invisible, When I submit, hCaptcha image was displayed.
I tried to solve with the code below.
When I try solve invisible, I submit then hCaptcha image was displayed. Could you help me know my mistakes?
Thank you for your help.
'■Fail.
Dim targetURL = "https://2captcha.com/demo/hcaptcha-invisible"
Dim sitekey = "f7de0da3-3303-44e8-ab48-fa32ff8ccc7b"
'■Success!
'Dim targetURL = "https://2captcha.com/demo/hcaptcha?difficulty=easy"
'Dim sitekey = "41b778e7-8f20-45cc-a804-1f1ebb45c579"
'■Success!
'Dim targetURL = "https://2captcha.com/demo/hcaptcha?difficulty=difficult"
'Dim sitekey = "f33236d2-3dff-4f1f-9aed-1dc3128a5f90"
'...omission...
'------------------------------------------------------------
'Get solve answer
'------------------------------------------------------------
Dim answer = stRetResponse.request
Debug.Print("Token:" & answer)
'------------------------------------------------------------
'Input the answer into the textarea
'------------------------------------------------------------
Dim textarea1 = driver.FindElements(By.Name("h-captcha-response"))(0)
driver.ExecuteScript($"arguments[0].value = '{answer}';", textarea1)
''Visualize textarea.
'CType(driver, IJavaScriptExecutor).ExecuteScript("document.getElementsByName('h-captcha-response')[0].setAttribute('style', 'display: true; height: 20px;');")
'------------------------------------------------------------
'Input the answer into the 'data-hcaptcha-response' attribute
'------------------------------------------------------------
Dim iframe As IWebElement = driver.FindElement(By.CssSelector("#root > div > main > div > section > form > div > div > div > iframe"))
driver.ExecuteScript($"arguments[0].setAttribute('data-hcaptcha-response', '{answer}');", iframe)
'------------------------------------------------------------
'Submit.
'------------------------------------------------------------
Dim form = driver.FindElements(By.CssSelector("#root > div > main > div > section > form"))(0)
form.Submit()