Bypass Yahoo reCAPTCHA by 2captcha API

Hick

New member
#1
I'm trying to create yahoo account using python selenium, and while creating i have to bypass a recaptcha. I'm using 2Captcha API to automate solving captchas

My issue is i can't solve recaptcha

based on my tests, i noticed that yahoo is using entreprise captcha, not sure if it's a V2 or V3

Here the API Documentation : https://2captcha.com/2captcha-api

here is my code :

Code:
import os

import time

from selenium.webdriver.chrome.options import Options

from selenium import webdriver

import random

from twocaptcha import TwoCaptcha



opt = Options()

opt.add_argument("--disable-infobars")

opt.add_argument("start-maximized")

# Pass the argument 1 to allow and 2 to block

opt.add_experimental_option("excludeSwitches", ["enable-logging"])

opt.add_experimental_option("prefs", {

        "profile.default_content_setting_values.media_stream_mic": 2,

        "profile.default_content_setting_values.media_stream_camera": 2,

        "profile.default_content_setting_values.geolocation": 2,

        "profile.default_content_setting_values.notifications": 2

    })



executable_path = r'chromedriver'

os.environ["webdriver.chrome.driver"] = executable_path





global driver







driver = webdriver.Chrome(r'chromedriver', options=opt)

time.sleep(5)



driver.get("https://login.yahoo.com/account/create")



# Fname and Lname

time.sleep(6)

driver.find_element_by_xpath("//input[@name='firstName']").send_keys("fname")

time.sleep(3)

driver.find_element_by_xpath("//input[@name='lastName']").send_keys("lname")



# Email

time.sleep(3)

numberid = random.randint(100000, 900000)

driver.find_element_by_xpath("//input[@name='yid']").send_keys("fname" + str(numberid) + "lname")



# Password

time.sleep(3)

driver.find_element_by_xpath("//input[@name='password']").send_keys("TestEPWD.")



######## number region +

FC = '(+212)'

option_el = driver.find_element_by_xpath("//option[contains(text(),'%s')]" % FC)

option_el.click()



driver.find_element_by_xpath("//input[@name='phone']").send_keys('684838340')



# Choose date

Month = random.randint(1, 12)

Months = "//option[@value='{}']".format(Month)

monthselect = driver.find_element_by_xpath(Months)

monthselect.click()



time.sleep(3)

Day = random.randint(1, 27)

driver.find_element_by_xpath("//input[@name='dd']").send_keys(Day)



time.sleep(3)

Year = random.randint(1975, 2000)

driver.find_element_by_xpath("//input[@name='yyyy']").send_keys(Year)



time.sleep(3)

list = ["Man", "Woman"]

item = random.choice(list)

driver.find_element_by_xpath("//input[@name='freeformGender']").send_keys(item)



time.sleep(3)

driver.find_element_by_xpath("//button[@name='signup']").click()



time.sleep(5)



# CAPTCHA PART :

api_key = os.getenv('APIKEY_2CAPTCHA', 'mycaptchaAPI')



solver = TwoCaptcha(api_key)

yy = driver.current_url



try:

    result = solver.recaptcha(

        sitekey="6LeGXAkbAAAAAAMGHQaxwylqpyvtF2jJMrvJff1h",

        url=yy,

        entreprise=1,

        version='v3',

        score=0.2

        )



except Exception as e:

    print(e)



else:

    print('result: ' + str(result))