ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.05k stars 1.09k forks source link

Bet365 detects undetected-chromedriver after performing login and trying to bet #611

Open alemosa opened 2 years ago

alemosa commented 2 years ago

CHROME VERSION: 99 UNDETECTED_CHROMEDRIVER VERSION: 3.1.3 SELENIUM VERSION: 4.1.2

This is happening since 1 month ago.

Steps to reproduce the error:

1- Use this code, with a correct BETUSER and PASSWORD and DEV_MODE = 'True'. CHROME_VERSION must match your current installed chrome (I'm using version 99 right now). As argument you must send a link, which should be a link for a match, for example "https://www.bet365.es/#/IP/EV151185512165C18". You can also send "https://bet365.es" (but you will have to comment the marked line in the code).

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC
import random
import pickle
import subprocess
import random
import undetected_chromedriver as uc
import time
from unidecode import unidecode
from shutil import which
import sys
import os

from decouple import config

## Defining variables
BETUSER = config('BETUSER')
PASSWORD = config('PASSWORD')
CHROME_VERSION = config('CHROME_VERSION')
DEV_MODE = config('DEV_MODE')
link = sys.argv[1]

if __name__ == '__main__':
    print(f"User = {BETUSER}, Password =  {PASSWORD}, Chrome Version = {CHROME_VERSION}, DEV Mode = {DEV_MODE}")
    options = webdriver.ChromeOptions()
    if DEV_MODE == 'True':
        options.add_argument("--start-maximized")
        options.add_argument("--disable-extensions")
    else:
        options.add_argument('--headless')
        options.add_argument('--disable-gpu') 
        pass
    chromedriver_path = which("./chromedriver")
    driver = uc.Chrome(executable_path = chromedriver_path, version_main = CHROME_VERSION, options = options)
    driver.get(link)

    WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((By.CSS_SELECTOR ,'div.bl-Preloader_Header')))

    ## ATTENTION Comment this line if using "https://bet365.es" as link:
    WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "div.ipe-EventViewView")))

    ## LOGIN FUNCTION
    if len(driver.find_elements(By.CSS_SELECTOR, 'div.hm-MainHeaderRHSLoggedOutWide_Login')) > 0:
        login = driver.find_elements(By.CSS_SELECTOR, 'div.hm-MainHeaderRHSLoggedOutWide_Login')[0].click()
        user_name = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.CSS_SELECTOR ,'input.lms-StandardLogin_Username')))
        user_name.clear()
        user_name.click()
        user_name.send_keys(BETUSER)
        #sendKeySlow(BETUSER,random.uniform(0.03,0.1),user_name,driver)
        passwd = driver.find_element(By.CSS_SELECTOR, 'input.lms-StandardLogin_Password')
        passwd.clear()
        passwd.click()
        passwd.send_keys(PASSWORD)
        #sendKeySlow(PASSWORD,random.uniform(0.03,0.1),passwd,driver)
        loginBtn = driver.find_element(By.CSS_SELECTOR, 'div.lms-LoginButton_Text')
        loginBtn.click()
        time.sleep(2)
        time.sleep(2)
        WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.CSS_SELECTOR ,'div.llm-LastLoginModule_Button')))
        driver.find_elements(By.CSS_SELECTOR, 'div.llm-LastLoginModule_Button')[0].click()
    time.sleep(1000)

2- Step 2: Let the bot perform the auto-login for you with your username and password. Afterwards, if you sent the link to a match, try to click on any bet. If you used "https://bet365.es" as the link, go to any match and try to perform a bet.

3- Step 3: After trying to perform the bet, you will see that the page reloads and logs you out of the platform.

Can anyone help with this?

sebdelsol commented 2 years ago

I have tried both links you provided on a regular Chrome browser and they both lands on the Cloudflare page with this captcha : image

So you'll have to wait for the checkbox to be clickable and click on it before trying to login :

im_human = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH ,'//div[@id="checkbox"]')))
im_human.click()
skyfyl commented 2 years ago

The same problem, I tried direct element click and ActionChains click, also tried pyautogui, all the same result, a pop-up appears along the lines of "sorry for the inconvenience an error occurred." and forces you to login out. Other clicks are normal, you can simulate login and challenge to the competition page, but when you click the odds when placing a bet, you will be forced to login out. Has anyone tried bypassing this restriction? bet365 is too complicated, js reverse cracking is too difficult. :(

efntallaris commented 2 years ago

Other clicks are normal, you can simulate login and challenge to the competition page, but when you click the odds when placing a bet, you will be forced to login out. Has anyone

Did you find any solution?

Iuryck commented 1 year ago

The same problem, I tried direct element click and ActionChains click, also tried pyautogui, all the same result, a pop-up appears along the lines of "sorry for the inconvenience an error occurred." and forces you to login out. Other clicks are normal, you can simulate login and challenge to the competition page, but when you click the odds when placing a bet, you will be forced to login out. Has anyone tried bypassing this restriction? bet365 is too complicated, js reverse cracking is too difficult. :(

same problem here

JoseZamora97 commented 1 year ago

Same problem, used chromedriver and pyautogui. Any update?

Shadownin2 commented 1 year ago

Undetectable-driver is still being detected :( Did anyone get around this?