@@ -2347,21 +2347,36 @@ def get_local_driver(
2347
2347
or is_using_uc (undetectable , browser_name )
2348
2348
):
2349
2349
if selenium4_or_newer :
2350
+ if headless and "linux" not in PLATFORM :
2351
+ undetectable = False # No support for headless
2350
2352
if undetectable :
2351
2353
from seleniumbase import undetected
2352
2354
from urllib .error import URLError
2353
2355
2354
2356
if "linux" in PLATFORM :
2355
- chrome_options .headless = False # Use xvfb
2357
+ chrome_options .headless = False # Use Xvfb
2358
+ if "--headless" in (
2359
+ chrome_options .arguments
2360
+ ):
2361
+ chrome_options .arguments .remove (
2362
+ "--headless"
2363
+ )
2356
2364
cert = "unable to get local issuer certificate"
2365
+ uc_chrome_version = None
2366
+ if (
2367
+ use_version .isnumeric
2368
+ and int (use_version ) >= 72
2369
+ ):
2370
+ uc_chrome_version = int (use_version )
2357
2371
uc_lock = fasteners .InterProcessLock (
2358
2372
constants .MultiBrowser .DRIVER_FIXING_LOCK
2359
2373
)
2360
- with uc_lock :
2374
+ with uc_lock : # No UC multithreaded tests
2361
2375
try :
2362
2376
driver = undetected .Chrome (
2363
2377
options = chrome_options ,
2364
- headless = headless ,
2378
+ headless = False , # Xvfb needed
2379
+ version_main = uc_chrome_version ,
2365
2380
)
2366
2381
except URLError as e :
2367
2382
if (
@@ -2375,7 +2390,8 @@ def get_local_driver(
2375
2390
)
2376
2391
driver = undetected .Chrome (
2377
2392
options = chrome_options ,
2378
- headless = headless ,
2393
+ headless = False , # Xvfb needed
2394
+ version_main = uc_chrome_version ,
2379
2395
)
2380
2396
else :
2381
2397
raise
0 commit comments