我正在尝试使用imagetyperz API解决验证码。
收到验证码响应后,我将其放入验证码输入框中,如下面的屏幕截图所示,但我不知道如何提交?
我正在使用以下代码:
driver.get('https://m.jeuxvideo.com/login?url=http%3A%2F%2Fm.jeuxvideo.com%2Fforums%2F0-4501-0-1-0-1-0-star-ixiom.htm&hash=a8e309f2189375923740ff14baa289c5')
time.sleep(2)
#catpch Solving--------------
access_token = 'XXXXXXXXXXXXXXXXXXXXXXXX'
ita = ImageTyperzAPI(access_token)
balance = ita.account_balance() # get account balance
print 'balance:', balance
page_url = driver.current_url
sitekey = '6LcuTQgUAAAAAIKvdcgeMOGr_Ds_0-gtp_mEqn1n'
captcha_id = ita.submit_recaptcha(page_url, sitekey)
print 'Waiting for recaptcha to be solved ...'
while ita.in_progress():
time.sleep(5)
print 'please wait...'
recaptcha_response = ita.retrieve_recaptcha(captcha_id)
print 'Recaptcha response:',recaptcha_response
element = driver.find_element_by_id('g-recaptcha-response')
driver.execute_script("arguments[0].style.display = 'block';", element)
driver.execute_script("arguments[0].parentNode.parentNode.style.display = 'block';", element)
time.sleep(1)
driver.find_element_by_id('g-recaptcha-response').send_keys(recaptcha_response)
time.sleep(1)
driver.find_element_by_css_selector('.sub-form-fmobile.js-g-recaptcha').click()
print 'done'