@@ -129,6 +129,16 @@ def _set_chrome_options(
129
129
chrome_options = _add_chrome_proxy_extension (
130
130
chrome_options , proxy_string , proxy_user , proxy_pass )
131
131
chrome_options .add_argument ('--proxy-server=%s' % proxy_string )
132
+ if headless :
133
+ if not proxy_auth :
134
+ # Headless Chrome doesn't support extensions, which are
135
+ # required when using a proxy server that has authentication.
136
+ # Instead, base_case.py will use PyVirtualDisplay when not
137
+ # using Chrome's built-in headless mode. See link for details:
138
+ # https://bugs.chromium.org/p/chromium/issues/detail?id=706008
139
+ chrome_options .add_argument ("--headless" )
140
+ chrome_options .add_argument ("--disable-gpu" )
141
+ chrome_options .add_argument ("--no-sandbox" )
132
142
return chrome_options
133
143
134
144
@@ -280,16 +290,6 @@ def get_remote_driver(
280
290
chrome_options = _set_chrome_options (
281
291
downloads_path , headless , proxy_string , proxy_auth ,
282
292
proxy_user , proxy_pass , user_agent , disable_csp )
283
- if headless :
284
- if not proxy_auth :
285
- # Headless Chrome doesn't support extensions, which are
286
- # required when using a proxy server that has authentication.
287
- # Instead, base_case.py will use PyVirtualDisplay when not
288
- # using Chrome's built-in headless mode. See link for details:
289
- # https://bugs.chromium.org/p/chromium/issues/detail?id=706008
290
- chrome_options .add_argument ("--headless" )
291
- chrome_options .add_argument ("--disable-gpu" )
292
- chrome_options .add_argument ("--no-sandbox" )
293
293
capabilities = chrome_options .to_capabilities ()
294
294
for key in desired_caps .keys ():
295
295
capabilities [key ] = desired_caps [key ]
@@ -491,16 +491,6 @@ def get_local_driver(
491
491
chrome_options = _set_chrome_options (
492
492
downloads_path , headless , proxy_string , proxy_auth ,
493
493
proxy_user , proxy_pass , user_agent , disable_csp )
494
- if headless :
495
- # Headless Chrome doesn't support extensions, which are
496
- # required when using a proxy server that has authentication.
497
- # Instead, base_case.py will use PyVirtualDisplay when not
498
- # using Chrome's built-in headless mode. See link for details:
499
- # https://bugs.chromium.org/p/chromium/issues/detail?id=706008
500
- if not proxy_auth :
501
- chrome_options .add_argument ("--headless" )
502
- chrome_options .add_argument ("--disable-gpu" )
503
- chrome_options .add_argument ("--no-sandbox" )
504
494
if LOCAL_CHROMEDRIVER and os .path .exists (LOCAL_CHROMEDRIVER ):
505
495
make_driver_executable_if_not (LOCAL_CHROMEDRIVER )
506
496
return webdriver .Chrome (
0 commit comments