undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

Not Support all options like webdriver

Open muhendis80 opened this issue 2 years ago • 2 comments

Hi, to bypass the bot detection, I first run chrome.exe and then take control but when I try to do it with the "uc" library it doesn't work

chromeadres="C:\Program Files\Google\Chrome\Application\chrome.exe" lokalproxy="55000" options = uc.ChromeOptions() options.add_experimental_option("debuggerAddress", "127.0.0.1:9225") chrome_driver = "C:/analizer/chromedriver.exe" subprocess.Popen([chromeadres,"--incognito","--remote-debugging-port=9225","--disable-infobars","--proxy-server=http://localhost:"+lokalproxy]) time.sleep(0.5) driver =webdriver.Chrome(executable_path=chrome_driver,chrome_options=options,seleniumwire_options={'port':int(lokalproxy)}) driver.get('https://nowsecure.nl')

it works but not pass "nowsecure.nl"

chromeadres="C:\Program Files\Google\Chrome\Application\chrome.exe" lokalproxy="55000" options = uc.ChromeOptions() options.add_experimental_option("debuggerAddress", "127.0.0.1:9225") chrome_driver = "C:/analizer/chromedriver.exe" subprocess.Popen([chromeadres,"--incognito","--remote-debugging-port=9225","--disable-infobars","--proxy-server=http://localhost:"+lokalproxy]) time.sleep(0.5) driver =uc.Chrome(executable_path=chrome_driver,chrome_options=options,seleniumwire_options={'port':int(lokalproxy)}) driver.get('https://nowsecure.nl')

if i changed webdriver-->uc is doesnt work.. gets this errors

Traceback (most recent call last): File "C:\Python\Interpreter\lib\multiprocessing\spawn.py", line 114, in _main prepare(preparation_data) File "C:\Python\Interpreter\lib\multiprocessing\spawn.py", line 225, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Python\Interpreter\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path run_name="mp_main") File "C:\Python\Interpreter\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Python\Interpreter\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Python\Interpreter\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Python\sahibfavori\sil.py", line 84, in driver =uc.Chrome(executable_path=chrome_driver,chrome_options=options,seleniumwire_options={'port':int(lokalproxy)}) File "C:\Python\Interpreter\lib\site-packages\seleniumwire\undetected_chromedriver\webdriver.py", line 61, in init super().init(*args, **kwargs) File "C:\Python\Interpreter\lib\site-packages\undetected_chromedriver_init.py", line 389, in init options.binary_location, *options.arguments File "C:\Python\Interpreter\lib\site-packages\undetected_chromedriver\dprocess.py", line 34, in start_detached daemon=True, File "C:\Python\Interpreter\lib\multiprocessing\process.py", line 112, in start self._popen = self._Popen(self) File "C:\Python\Interpreter\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Python\Interpreter\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Python\Interpreter\lib\multiprocessing\popen_spawn_win32.py", line 46, in init prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Python\Interpreter\lib\multiprocessing\spawn.py", line 143, in get_preparation_data _check_not_importing_main() File "C:\Python\Interpreter\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main is not going to be frozen to produce an executable.''') RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

Thanks,regards

muhendis80 avatar Jun 02 '22 11:06 muhendis80

  • You don't need to manually open the Chrome process, undetected-chromedriver does that for you. And the Chrome process is detached which is better for avoiding detection.
  • Only 'prefs' experimental options are supported, because the driver can't push experimental options on an already opened browser. For 'prefs' there's a workaround by modifying the the Chrome profile Preferences file.
  • If you want selenium-wire working with undetected-chromedriver, please check their documentation here.
  • For the multiprocessing error : you've stumbled upon a recurrent non-issue .

sebdelsol avatar Jun 02 '22 12:06 sebdelsol

  • You don't need to manually open the Chrome process, undetected-chromedriver does that for you. And the Chrome process is detached which is better for avoiding detection.
  • Only 'prefs' experimental options are supported, because the driver can't push experimental options on an already opened browser. For 'prefs' there's a workaround by modifying the the Chrome profile Preferences file.
  • If you want selenium-wire working with undetected-chromedriver, please check their documentation here.
  • For the multiprocessing error : you've stumbled upon a recurrent non-issue .

How can I use these value params = [ self.executablePath, '--remote-debugging-port='+str(self.port), '--user-data-dir='+self.profile_path, '--password-store=basic', ] subprocess.Popen(params, start_new_session=True) with undetectchromedriver?

guidetuanhp avatar Jun 17 '22 20:06 guidetuanhp