Add command-line shortcuts for SB() and Driver()
This commit is contained in:
parent
989bd866fd
commit
97d6b3a8ca
|
@ -328,6 +328,12 @@ def Driver(
|
||||||
):
|
):
|
||||||
recorder_mode = True
|
recorder_mode = True
|
||||||
recorder_ext = True
|
recorder_ext = True
|
||||||
|
if headed is None:
|
||||||
|
# Override the default headless mode on Linux if set.
|
||||||
|
if "--gui" in sys_argv or "--headed" in sys_argv:
|
||||||
|
headed = True
|
||||||
|
else:
|
||||||
|
headed = False
|
||||||
if (
|
if (
|
||||||
shared_utils.is_linux()
|
shared_utils.is_linux()
|
||||||
and not headed
|
and not headed
|
||||||
|
@ -434,6 +440,13 @@ def Driver(
|
||||||
disable_js = False
|
disable_js = False
|
||||||
if pls is not None and page_load_strategy is None:
|
if pls is not None and page_load_strategy is None:
|
||||||
page_load_strategy = pls
|
page_load_strategy = pls
|
||||||
|
if not page_load_strategy and "--pls=" in arg_join:
|
||||||
|
if "--pls=none" in sys_argv or '--pls="none"' in sys_argv:
|
||||||
|
page_load_strategy = "none"
|
||||||
|
elif "--pls=eager" in sys_argv or '--pls="eager"' in sys_argv:
|
||||||
|
page_load_strategy = "eager"
|
||||||
|
elif "--pls=normal" in sys_argv or '--pls="normal"' in sys_argv:
|
||||||
|
page_load_strategy = "normal"
|
||||||
if page_load_strategy is not None:
|
if page_load_strategy is not None:
|
||||||
if page_load_strategy.lower() not in ["normal", "eager", "none"]:
|
if page_load_strategy.lower() not in ["normal", "eager", "none"]:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
|
|
|
@ -378,9 +378,20 @@ def SB(
|
||||||
record_sleep = True
|
record_sleep = True
|
||||||
else:
|
else:
|
||||||
record_sleep = False
|
record_sleep = False
|
||||||
|
if xvfb is None:
|
||||||
|
if "--xvfb" in sys_argv:
|
||||||
|
xvfb = True
|
||||||
|
else:
|
||||||
|
xvfb = False
|
||||||
if not shared_utils.is_linux():
|
if not shared_utils.is_linux():
|
||||||
# The Xvfb virtual display server is for Linux OS Only!
|
# The Xvfb virtual display server is for Linux OS Only!
|
||||||
xvfb = False
|
xvfb = False
|
||||||
|
if headed is None:
|
||||||
|
# Override the default headless mode on Linux if set.
|
||||||
|
if "--gui" in sys_argv or "--headed" in sys_argv:
|
||||||
|
headed = True
|
||||||
|
else:
|
||||||
|
headed = False
|
||||||
if (
|
if (
|
||||||
shared_utils.is_linux()
|
shared_utils.is_linux()
|
||||||
and not headed
|
and not headed
|
||||||
|
@ -532,6 +543,13 @@ def SB(
|
||||||
_disable_beforeunload = True
|
_disable_beforeunload = True
|
||||||
if pls is not None and page_load_strategy is None:
|
if pls is not None and page_load_strategy is None:
|
||||||
page_load_strategy = pls
|
page_load_strategy = pls
|
||||||
|
if not page_load_strategy and "--pls=" in arg_join:
|
||||||
|
if "--pls=none" in sys_argv or '--pls="none"' in sys_argv:
|
||||||
|
page_load_strategy = "none"
|
||||||
|
elif "--pls=eager" in sys_argv or '--pls="eager"' in sys_argv:
|
||||||
|
page_load_strategy = "eager"
|
||||||
|
elif "--pls=normal" in sys_argv or '--pls="normal"' in sys_argv:
|
||||||
|
page_load_strategy = "normal"
|
||||||
if page_load_strategy is not None:
|
if page_load_strategy is not None:
|
||||||
if page_load_strategy.lower() not in ["normal", "eager", "none"]:
|
if page_load_strategy.lower() not in ["normal", "eager", "none"]:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
|
|
Loading…
Reference in New Issue