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.06k stars 1.09k forks source link

Undetected-Chromedriver not working with compiled .exe version. #732

Open xooelae opened 1 year ago

xooelae commented 1 year ago

Hi, I compile my python program with cx_freeze after compile i have tried so many times to run undetected chromedriver but its never worked! But Selenium is working fine without any issue.

When i run with undetected chromedriver it shows a error that init() got an unexpected keyword argument 'driver_executable_path'

This error shows up only when i convert the python program to exe. I also tried py2exe same issue happens.

yeucodonvn commented 1 year ago

i using pyinstaller without arg one-file

xooelae commented 1 year ago

i using pyinstaller without arg one-file

Even if it's run properly it can't bypass the cloudflare on complied version also if we add options it run like normal selenium. Can you please help me to solve these issue?

no-name-user-name commented 1 year ago

driver = uc.Chrome(use_subprocess=True)

mechxer commented 1 year ago

driver = uc.Chrome(use_subprocess=True)

It worked thanks!

Also can you help me how to hide the console with compiled version for undetected chromedriver, i have tried freeze_support() on the top of the code also i tried chrome_service.creationflags = CREATE_NO_WINDOW but it doesn't worked for me, it always open a blank console.

Thanks for your reply

no-name-user-name commented 1 year ago

for cx_freeze on Windows use base = "Win32GUI"

import cx_Freeze

exe = [cx_Freeze.Executable("main.py", base = "Win32GUI")]

cx_Freeze.setup(
    name = "Name",
    version = "1.0",
    options = {"build_exe": {"packages": [],  
        "include_files": []}},
    executables = exe
) 

for pyinstaller: pyinstaller --noconsole yourscript.py

driver = uc.Chrome(use_subprocess=True)

It worked thanks!

Also can you help me how to hide the console with compiled version for undetected chromedriver, i have tried freeze_support() on the top of the code also i tried chrome_service.creationflags = CREATE_NO_WINDOW but it doesn't worked for me, it always open a blank console.

Thanks for your reply

xooelae commented 1 year ago

for cx_freeze on Windows use base = "Win32GUI"

import cx_Freeze

exe = [cx_Freeze.Executable("main.py", base = "Win32GUI")]

cx_Freeze.setup(
    name = "Name",
    version = "1.0",
    options = {"build_exe": {"packages": [],  
        "include_files": []}},
    executables = exe
) 

for pyinstaller: pyinstaller --noconsole yourscript.py

driver = uc.Chrome(use_subprocess=True)

It worked thanks! Also can you help me how to hide the console with compiled version for undetected chromedriver, i have tried freeze_support() on the top of the code also i tried chrome_service.creationflags = CREATE_NO_WINDOW but it doesn't worked for me, it always open a blank console. Thanks for your reply

Yes i always compile with Win32GUI in Cx_Freeze But it doesn't not worked for me.

If you have other solution please help us.

Thanks again.

sebdelsol commented 1 year ago

@mechxer

Also can you help me how to hide the console with compiled version for undetected chromedriver i tried chrome_service.creationflags = CREATE_NO_WINDOW but it doesn't worked for me, it always open a blank console

This is non-trivial because UC creates its own service and you can't simply set the creationflags to an existing service. Please check #623 where you'll find how to make it work.