@@ -610,7 +610,14 @@ def _set_chrome_options(
610610 chrome_options .add_argument ("--dns-prefetch-disable" )
611611 chrome_options .add_argument ("--disable-translate" )
612612 chrome_options .add_argument ("--disable-3d-apis" )
613- if is_using_uc (undetectable , browser_name ):
613+ if (
614+ is_using_uc (undetectable , browser_name )
615+ and (
616+ not headless
617+ or "linux" in PLATFORM # switches to Xvfb (non-headless)
618+ )
619+ ):
620+ # Skip remaining options that trigger anti-bot services
614621 return chrome_options
615622 chrome_options .add_argument ("--test-type" )
616623 chrome_options .add_argument ("--log-level=3" )
@@ -2428,6 +2435,7 @@ def get_local_driver(
24282435 uc_path = os .path .realpath (uc_path )
24292436 driver = undetected .Chrome (
24302437 options = chrome_options ,
2438+ user_data_dir = user_data_dir ,
24312439 driver_executable_path = uc_path ,
24322440 headless = False , # Xvfb needed!
24332441 version_main = uc_chrome_version ,
@@ -2444,6 +2452,7 @@ def get_local_driver(
24442452 )
24452453 driver = undetected .Chrome (
24462454 options = chrome_options ,
2455+ user_data_dir = user_data_dir ,
24472456 driver_executable_path = uc_path ,
24482457 headless = False , # Xvfb needed!
24492458 version_main = uc_chrome_version ,
0 commit comments