Skip to content

Commit 55c115c

Browse files
committed
[py] Fix options in conftest.py
1 parent 6b1f51f commit 55c115c

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

py/conftest.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,22 @@ def get_options(driver_class, config):
217217
browser_args = config.option.args
218218
headless = config.option.headless
219219
bidi = config.option.bidi
220+
options = None
220221

221-
options = getattr(webdriver, f"{driver_class}Options")()
222-
223-
if driver_class == "WebKitGTK":
224-
options.overlay_scrollbars_enabled = False
225-
226-
if browser_path is not None:
227-
options.binary_location = browser_path.strip("'")
228-
229-
if browser_args is not None:
230-
for arg in browser_args.split():
231-
options.add_argument(arg)
222+
if browser_path or browser_args:
223+
if not options:
224+
options = getattr(webdriver, f"{driver_class}Options")()
225+
if driver_class == "WebKitGTK":
226+
options.overlay_scrollbars_enabled = False
227+
if browser_path is not None:
228+
options.binary_location = browser_path.strip("'")
229+
if browser_args is not None:
230+
for arg in browser_args.split():
231+
options.add_argument(arg)
232232

233233
if headless:
234+
if not options:
235+
options = getattr(webdriver, f"{driver_class}Options")()
234236
if driver_class == "Chrome" or driver_class == "Edge":
235237
options.add_argument("--headless=new")
236238
if driver_class == "Firefox":

0 commit comments

Comments
 (0)