Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98504

Java/Kotlin Selenium Chromedriver 2Captcha

$
0
0

I'm trying to learn about 2Captcha nad as an example i wanted to make a spotify account. I've gotten to fill the form just right, but the only concern is the 2Captcha. I've tried all sorts of ways found on here but none of them worked. I've tried:

  • ___grecaptcha_cfg.clients[0].bL.K.callback('token');
  • window.captchaSuccessCallback(); (this was found in grecaptcha.render method)
  • And this was my last approach:
    val captcha = driver.findElement(By.id("captcha-div"))
    val siteKey = captcha?.getAttribute("data-sitekey") ?: ""
    println("Site key: $siteKey")

    val solvedCaptcha = getCaptcha(siteKey, "2captchaKey", driver.currentUrl)
    val js = driver as JavascriptExecutor
    println(solvedCaptcha)
    js.executeScript("document.getElementById('g-recaptcha-response').innerHTML='$solvedCaptcha';")
    Thread.sleep(500)

    val iframe = driver.findElement(By.xpath("//iframe[@title='recaptcha challenge']"))
    println(iframe.toString())
    driver.switchTo().frame(iframe)
    js.executeScript("document.getElementById('recaptcha-verify-button').click();")

the url i'm using is Here


Viewing all articles
Browse latest Browse all 98504

Latest Images

Trending Articles



Latest Images