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

Using selenium to solve captcha

$
0
0

My Code below is keep solving a different Captcha ! Please correct my mistake as i don't know what's causing that!

from selenium import webdriver
from python3_anticaptcha import ImageToTextTask, CallbackClient
import time
import requests

browser = webdriver.Firefox()

url = 'https://galiathus.ru/'
browser.get(url)
time.sleep(10)
username = browser.find_element_by_id("SellersLoginForm_username")
username.send_keys("testuser")
password = browser.find_element_by_id("SellersLoginForm_password")
password.send_keys("testpass")

image_link = browser.find_element_by_xpath(
    '//*[@id="yw1"]').get_attribute('src')
pic = requests.get(image_link)
if pic.status_code == 200:
    with open("image.png", 'wb') as f:
        f.write(pic.content)
ANTICAPTCHA_KEY = '396bbf3b9317df34592b7788cebec800'
captcha_file = "image.png"
result = ImageToTextTask.ImageToTextTask(
    anticaptcha_key=ANTICAPTCHA_KEY).captcha_handler(captcha_file=captcha_file)

captcha = browser.find_element_by_id("SellersLoginForm_captcha")
captcha.send_keys(result['solution']['text'])
login = browser.find_element_by_id("yw2")

Be Informed that the API is active so you can use it till you reach a solution. and then i will change it.

Also the accuracy of solving is 100%


Viewing all articles
Browse latest Browse all 97790

Trending Articles