Hi, everyone, I'm trying to bypass Hotbit CAPTCHA. I've been trying to do this with Selenium, however website somehow recognizes it's ran by automation and declines CAPTCHA resolve.
Even when I try to solve CAPTCHA manually (but launch browser session programatically), it fails.
If I launch browser manually, then attach Selenium webdriver to the session, manual CAPTCHA resolve works.
So I'm guessing website is detecting something weird in how browser session is launched?
Here is the full code:
I am a new member so can't type website links but you should replace "login_page_url" in the code with hotbit.io/login URL.
Any ideas would be appreciated. Thanks.
Even when I try to solve CAPTCHA manually (but launch browser session programatically), it fails.
If I launch browser manually, then attach Selenium webdriver to the session, manual CAPTCHA resolve works.
So I'm guessing website is detecting something weird in how browser session is launched?
Here is the full code:
Code:
import time
import os
import random
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
class Hotbit:
username = None
password = None
browser = None
def __init__(self, username, password):
# iniitialize class and attempt to login
self.username = username
self.password = password
self.init_driver()
self.login()
def init_driver(self):
# initialize webdriver
options = webdriver.ChromeOptions()
# options.headless = True
options.add_argument('--user-data-dir=c:\\Users\\rsrx\\appdata\\Local\\Google\\Chrome\\User Data\\')
self.browser = webdriver.Chrome(executable_path='./drivers/chromedriver.exe', options=options)
def login(self):
# load login page
try:
print('Loading login page...')
self.browser.get(login_page_url)
WebDriverWait(self.browser, 15).until(ec.presence_of_element_located((By.ID, 'nc_1_n1z')))
except TimeoutException:
print('Load timeout')
return False
# solve CAPTCHA
print('Resolving CAPTCHA...')
print(self.drag_slider())
def drag_slider(self):
slider = self.browser.find_element_by_id('nc_1_n1z')
slider.click()
ac = ActionChains(self.browser)
ac.move_to_element(slider)
ac.click_and_hold(slider)
xoffset = 0
while xoffset < 350:
xmove = random.randint(10, 50)
ymove = random.randint(-1, 1)
ac.move_by_offset(xmove, ymove)
xoffset += xmove
ac.release()
ac.perform()
time.sleep(3)
element = self.browser.find_element_by_class_name('nc-lang-cnt')
print(element.text)
if __name__ == '__main__':
hotbit = Hotbit('username', 'password')
I am a new member so can't type website links but you should replace "login_page_url" in the code with hotbit.io/login URL.
Any ideas would be appreciated. Thanks.
Last edited: