seleniumbase 4.30.8__py3-none-any.whl → 4.31.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sbase/__init__.py +1 -0
- seleniumbase/__init__.py +2 -3
- seleniumbase/__version__.py +1 -1
- seleniumbase/behave/behave_sb.py +59 -11
- seleniumbase/config/settings.py +4 -0
- seleniumbase/console_scripts/logo_helper.py +47 -0
- seleniumbase/console_scripts/run.py +7 -4
- seleniumbase/console_scripts/sb_behave_gui.py +5 -5
- seleniumbase/console_scripts/sb_caseplans.py +6 -6
- seleniumbase/console_scripts/sb_commander.py +5 -5
- seleniumbase/console_scripts/sb_install.py +10 -2
- seleniumbase/console_scripts/sb_recorder.py +4 -4
- seleniumbase/core/browser_launcher.py +179 -108
- seleniumbase/core/mysql.py +1 -4
- seleniumbase/core/recorder_helper.py +24 -5
- seleniumbase/core/sb_driver.py +13 -3
- seleniumbase/core/settings_parser.py +4 -0
- seleniumbase/fixtures/base_case.py +324 -493
- seleniumbase/fixtures/js_utils.py +19 -52
- seleniumbase/fixtures/page_actions.py +3 -6
- seleniumbase/fixtures/page_utils.py +18 -53
- seleniumbase/plugins/base_plugin.py +2 -3
- seleniumbase/plugins/driver_manager.py +182 -5
- seleniumbase/plugins/pytest_plugin.py +51 -23
- seleniumbase/plugins/sb_manager.py +185 -5
- seleniumbase/plugins/selenium_plugin.py +71 -8
- seleniumbase/undetected/__init__.py +13 -38
- seleniumbase/undetected/dprocess.py +4 -6
- seleniumbase/undetected/options.py +3 -6
- seleniumbase/undetected/patcher.py +2 -3
- {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/METADATA +111 -125
- {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/RECORD +36 -47
- {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/WHEEL +1 -1
- sbase/ReadMe.txt +0 -2
- seleniumbase/ReadMe.md +0 -25
- seleniumbase/common/ReadMe.md +0 -71
- seleniumbase/console_scripts/ReadMe.md +0 -734
- seleniumbase/drivers/ReadMe.md +0 -27
- seleniumbase/extensions/ReadMe.md +0 -12
- seleniumbase/masterqa/ReadMe.md +0 -61
- seleniumbase/resources/ReadMe.md +0 -31
- seleniumbase/resources/favicon.ico +0 -0
- seleniumbase/utilities/selenium_grid/ReadMe.md +0 -84
- seleniumbase/utilities/selenium_ide/ReadMe.md +0 -111
- {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/LICENSE +0 -0
- {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/top_level.txt +0 -0
@@ -4,6 +4,7 @@ import os
|
|
4
4
|
import pytest
|
5
5
|
import sys
|
6
6
|
import time
|
7
|
+
from contextlib import suppress
|
7
8
|
from seleniumbase import config as sb_config
|
8
9
|
from seleniumbase.config import settings
|
9
10
|
from seleniumbase.core import log_helper
|
@@ -61,10 +62,12 @@ def pytest_addoption(parser):
|
|
61
62
|
--sjw (Skip JS Waits for readyState to be "complete" or Angular to load.)
|
62
63
|
--wfa (Wait for AngularJS to be done loading after specific web actions.)
|
63
64
|
--pls=PLS (Set pageLoadStrategy on Chrome: "normal", "eager", or "none".)
|
64
|
-
--headless (
|
65
|
-
--
|
65
|
+
--headless (The default headless mode. Linux uses this mode by default.)
|
66
|
+
--headless1 (Use Chrome's old headless mode. Fast, but has limitations.)
|
67
|
+
--headless2 (Use Chrome's new headless mode, which supports extensions.)
|
66
68
|
--headed (Run tests in headed/GUI mode on Linux OS, where not default.)
|
67
69
|
--xvfb (Run tests using the Xvfb virtual display server on Linux OS.)
|
70
|
+
--xvfb-metrics=STRING (Set Xvfb display size on Linux: "Width,Height".)
|
68
71
|
--locale=LOCALE_CODE (Set the Language Locale Code for the web browser.)
|
69
72
|
--interval=SECONDS (The autoplay interval for presentations & tour steps)
|
70
73
|
--start-page=URL (The starting URL for the web browser when tests begin.)
|
@@ -109,6 +112,7 @@ def pytest_addoption(parser):
|
|
109
112
|
--rcs | --reuse-class-session (Reuse session for tests in class.)
|
110
113
|
--crumbs (Delete all cookies between tests reusing a session.)
|
111
114
|
--disable-beforeunload (Disable the "beforeunload" event on Chrome.)
|
115
|
+
--window-position=X,Y (Set the browser's starting window position.)
|
112
116
|
--window-size=WIDTH,HEIGHT (Set the browser's starting window size.)
|
113
117
|
--maximize (Start tests with the browser window maximized.)
|
114
118
|
--screenshot (Save a screenshot at the end of each test.)
|
@@ -697,6 +701,15 @@ def pytest_addoption(parser):
|
|
697
701
|
UNLESS using a virtual display with Xvfb.
|
698
702
|
Default: False on Mac/Windows. True on Linux.""",
|
699
703
|
)
|
704
|
+
parser.addoption(
|
705
|
+
"--headless1",
|
706
|
+
action="store_true",
|
707
|
+
dest="headless1",
|
708
|
+
default=False,
|
709
|
+
help="""This option activates the old headless mode,
|
710
|
+
which is faster, but has limitations.
|
711
|
+
(May be phased out by Chrome in the future.)""",
|
712
|
+
)
|
700
713
|
parser.addoption(
|
701
714
|
"--headless2",
|
702
715
|
action="store_true",
|
@@ -728,6 +741,17 @@ def pytest_addoption(parser):
|
|
728
741
|
will no longer be enabled by default on Linux.
|
729
742
|
Default: False. (Linux-ONLY!)""",
|
730
743
|
)
|
744
|
+
parser.addoption(
|
745
|
+
"--xvfb-metrics",
|
746
|
+
"--xvfb_metrics",
|
747
|
+
action="store",
|
748
|
+
dest="xvfb_metrics",
|
749
|
+
default=None,
|
750
|
+
help="""Customize the Xvfb metrics (Width,Height) on Linux.
|
751
|
+
Format: A comma-separated string with the 2 values.
|
752
|
+
Examples: "1920,1080" or "1366,768" or "1024,768".
|
753
|
+
Default: None. (None: "1366,768". Min: "1024,768".)""",
|
754
|
+
)
|
731
755
|
parser.addoption(
|
732
756
|
"--locale_code",
|
733
757
|
"--locale-code",
|
@@ -1229,6 +1253,17 @@ def pytest_addoption(parser):
|
|
1229
1253
|
on Chromium browsers (Chrome or Edge).
|
1230
1254
|
This is already the default Firefox option.""",
|
1231
1255
|
)
|
1256
|
+
parser.addoption(
|
1257
|
+
"--window-position",
|
1258
|
+
"--window_position",
|
1259
|
+
action="store",
|
1260
|
+
dest="window_position",
|
1261
|
+
default=None,
|
1262
|
+
help="""The option to set the starting window x,y position
|
1263
|
+
Format: A comma-separated string with the 2 values.
|
1264
|
+
Example: "55,66"
|
1265
|
+
Default: None. (Will use default values if None)""",
|
1266
|
+
)
|
1232
1267
|
parser.addoption(
|
1233
1268
|
"--window-size",
|
1234
1269
|
"--window_size",
|
@@ -1508,6 +1543,9 @@ def pytest_configure(config):
|
|
1508
1543
|
sb_config.mobile_emulator = config.getoption("mobile_emulator")
|
1509
1544
|
sb_config.device_metrics = config.getoption("device_metrics")
|
1510
1545
|
sb_config.headless = config.getoption("headless")
|
1546
|
+
sb_config.headless1 = config.getoption("headless1")
|
1547
|
+
if sb_config.headless1:
|
1548
|
+
sb_config.headless = True
|
1511
1549
|
sb_config.headless2 = config.getoption("headless2")
|
1512
1550
|
if sb_config.headless2 and sb_config.browser == "firefox":
|
1513
1551
|
sb_config.headless2 = False # Only for Chromium browsers
|
@@ -1516,6 +1554,7 @@ def pytest_configure(config):
|
|
1516
1554
|
sb_config.headless2 = False # Only for Chromium browsers
|
1517
1555
|
sb_config.headed = config.getoption("headed")
|
1518
1556
|
sb_config.xvfb = config.getoption("xvfb")
|
1557
|
+
sb_config.xvfb_metrics = config.getoption("xvfb_metrics")
|
1519
1558
|
sb_config.locale_code = config.getoption("locale_code")
|
1520
1559
|
sb_config.interval = config.getoption("interval")
|
1521
1560
|
sb_config.start_page = config.getoption("start_page")
|
@@ -1624,6 +1663,7 @@ def pytest_configure(config):
|
|
1624
1663
|
sb_config.shared_driver = None # The default driver for session reuse
|
1625
1664
|
sb_config.crumbs = config.getoption("crumbs")
|
1626
1665
|
sb_config._disable_beforeunload = config.getoption("_disable_beforeunload")
|
1666
|
+
sb_config.window_position = config.getoption("window_position")
|
1627
1667
|
sb_config.window_size = config.getoption("window_size")
|
1628
1668
|
sb_config.maximize_option = config.getoption("maximize_option")
|
1629
1669
|
sb_config.save_screenshot = config.getoption("save_screenshot")
|
@@ -1732,6 +1772,7 @@ def pytest_configure(config):
|
|
1732
1772
|
# Recorder Mode can still optimize scripts in --headless2 mode.
|
1733
1773
|
if sb_config.recorder_mode and sb_config.headless:
|
1734
1774
|
sb_config.headless = False
|
1775
|
+
sb_config.headless1 = False
|
1735
1776
|
sb_config.headless2 = True
|
1736
1777
|
|
1737
1778
|
if not sb_config.headless and not sb_config.headless2:
|
@@ -1752,6 +1793,7 @@ def pytest_configure(config):
|
|
1752
1793
|
|
1753
1794
|
if sb_config.browser == "safari" and sb_config.headless:
|
1754
1795
|
sb_config.headless = False # Safari doesn't support headless mode
|
1796
|
+
sb_config.headless1 = False
|
1755
1797
|
|
1756
1798
|
if sb_config.dash_title:
|
1757
1799
|
constants.Dashboard.TITLE = sb_config.dash_title.replace("_", " ")
|
@@ -1822,10 +1864,8 @@ def _create_dashboard_assets_():
|
|
1822
1864
|
abs_path = os.path.abspath(".")
|
1823
1865
|
assets_folder = os.path.join(abs_path, "assets")
|
1824
1866
|
if not os.path.exists(assets_folder):
|
1825
|
-
|
1867
|
+
with suppress(Exception):
|
1826
1868
|
os.makedirs(assets_folder, exist_ok=True)
|
1827
|
-
except Exception:
|
1828
|
-
pass
|
1829
1869
|
pytest_style_css = os.path.join(assets_folder, "pytest_style.css")
|
1830
1870
|
add_pytest_style_css = True
|
1831
1871
|
if os.path.exists(pytest_style_css):
|
@@ -1897,12 +1937,10 @@ def pytest_collection_finish(session):
|
|
1897
1937
|
dash_path = os.path.join(os.getcwd(), "dashboard.html")
|
1898
1938
|
dash_url = "file://" + dash_path.replace("\\", "/")
|
1899
1939
|
star_len = len("Dashboard: ") + len(dash_url)
|
1900
|
-
|
1940
|
+
with suppress(Exception):
|
1901
1941
|
terminal_size = os.get_terminal_size().columns
|
1902
1942
|
if terminal_size > 30 and star_len > terminal_size:
|
1903
1943
|
star_len = terminal_size
|
1904
|
-
except Exception:
|
1905
|
-
pass
|
1906
1944
|
stars = "*" * star_len
|
1907
1945
|
c1 = ""
|
1908
1946
|
cr = ""
|
@@ -1944,11 +1982,11 @@ def pytest_runtest_teardown(item):
|
|
1944
1982
|
(Has zero effect on tests using --reuse-session / --rs)"""
|
1945
1983
|
if "--co" in sys_argv or "--collect-only" in sys_argv:
|
1946
1984
|
return
|
1947
|
-
|
1985
|
+
with suppress(Exception):
|
1948
1986
|
if hasattr(item, "_testcase") or hasattr(sb_config, "_sb_pdb_driver"):
|
1949
1987
|
if hasattr(item, "_testcase"):
|
1950
1988
|
self = item._testcase
|
1951
|
-
|
1989
|
+
with suppress(Exception):
|
1952
1990
|
if (
|
1953
1991
|
hasattr(self, "driver")
|
1954
1992
|
and self.driver
|
@@ -1956,22 +1994,18 @@ def pytest_runtest_teardown(item):
|
|
1956
1994
|
):
|
1957
1995
|
if not (is_windows or self.driver.service.process):
|
1958
1996
|
self.driver.quit()
|
1959
|
-
except Exception:
|
1960
|
-
pass
|
1961
1997
|
elif (
|
1962
1998
|
hasattr(sb_config, "_sb_pdb_driver")
|
1963
1999
|
and sb_config._sb_pdb_driver
|
1964
2000
|
):
|
1965
|
-
|
2001
|
+
with suppress(Exception):
|
1966
2002
|
if (
|
1967
2003
|
not is_windows
|
1968
2004
|
or sb_config._sb_pdb_driver.service.process
|
1969
2005
|
):
|
1970
2006
|
sb_config._sb_pdb_driver.quit()
|
1971
2007
|
sb_config._sb_pdb_driver = None
|
1972
|
-
|
1973
|
-
pass
|
1974
|
-
try:
|
2008
|
+
with suppress(Exception):
|
1975
2009
|
if (
|
1976
2010
|
hasattr(self, "_xvfb_display")
|
1977
2011
|
and self._xvfb_display
|
@@ -1988,10 +2022,6 @@ def pytest_runtest_teardown(item):
|
|
1988
2022
|
):
|
1989
2023
|
sb_config._virtual_display.stop()
|
1990
2024
|
sb_config._virtual_display = None
|
1991
|
-
except Exception:
|
1992
|
-
pass
|
1993
|
-
except Exception:
|
1994
|
-
pass
|
1995
2025
|
if (
|
1996
2026
|
(
|
1997
2027
|
sb_config._has_exception
|
@@ -2372,7 +2402,7 @@ def pytest_runtest_makereport(item, call):
|
|
2372
2402
|
)
|
2373
2403
|
if log_path:
|
2374
2404
|
sb_config._log_fail_data()
|
2375
|
-
|
2405
|
+
with suppress(Exception):
|
2376
2406
|
extra_report = None
|
2377
2407
|
if hasattr(item, "_testcase"):
|
2378
2408
|
extra_report = item._testcase._html_report_extra
|
@@ -2417,5 +2447,3 @@ def pytest_runtest_makereport(item, call):
|
|
2417
2447
|
"</script>" % constants.Dashboard.LIVE_JS
|
2418
2448
|
)
|
2419
2449
|
report.extra.append(pytest_html.extras.html(refresh_updates))
|
2420
|
-
except Exception:
|
2421
|
-
pass
|
@@ -7,7 +7,7 @@ Usage --> ``with SB() as sb:``
|
|
7
7
|
|
8
8
|
Example -->
|
9
9
|
|
10
|
-
```
|
10
|
+
```python
|
11
11
|
from seleniumbase import SB
|
12
12
|
|
13
13
|
with SB() as sb: # Many args! Eg. SB(browser="edge")
|
@@ -32,8 +32,9 @@ def SB(
|
|
32
32
|
rtf=None, # Shortcut / Duplicate of "raise_test_failure".
|
33
33
|
raise_test_failure=None, # If "test" mode, raise Exception on 1st failure.
|
34
34
|
browser=None, # Choose from "chrome", "edge", "firefox", or "safari".
|
35
|
-
headless=None, #
|
36
|
-
|
35
|
+
headless=None, # Use the default headless mode for Chromium and Firefox.
|
36
|
+
headless1=None, # Use Chromium's old headless mode. (Fast, but limited)
|
37
|
+
headless2=None, # Use Chromium's new headless mode. (Has more features)
|
37
38
|
locale_code=None, # Set the Language Locale Code for the web browser.
|
38
39
|
protocol=None, # The Selenium Grid protocol: "http" or "https".
|
39
40
|
servername=None, # The Selenium Grid server/IP used for tests.
|
@@ -41,7 +42,7 @@ def SB(
|
|
41
42
|
proxy=None, # Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT".
|
42
43
|
proxy_bypass_list=None, # Skip proxy when using the listed domains.
|
43
44
|
proxy_pac_url=None, # Use PAC file. (Format: URL or USERNAME:PASSWORD@URL)
|
44
|
-
multi_proxy=
|
45
|
+
multi_proxy=None, # Allow multiple proxies with auth when multi-threaded.
|
45
46
|
agent=None, # Modify the web browser's User-Agent string.
|
46
47
|
cap_file=None, # The desired capabilities to use with a Selenium Grid.
|
47
48
|
cap_string=None, # The desired capabilities to use with a Selenium Grid.
|
@@ -79,10 +80,13 @@ def SB(
|
|
79
80
|
wait_for_angularjs=None, # Wait for AngularJS to load after some actions.
|
80
81
|
use_wire=None, # Use selenium-wire's webdriver over selenium webdriver.
|
81
82
|
external_pdf=None, # Set Chrome "plugins.always_open_pdf_externally":True.
|
83
|
+
window_position=None, # Set the browser's starting window position: "X,Y"
|
84
|
+
window_size=None, # Set the browser's starting window size: "Width,Height"
|
82
85
|
is_mobile=None, # Use the mobile device emulator while running tests.
|
83
86
|
mobile=None, # Shortcut / Duplicate of "is_mobile".
|
84
87
|
device_metrics=None, # Set mobile metrics: "CSSWidth,CSSHeight,PixelRatio"
|
85
88
|
xvfb=None, # Run tests using the Xvfb virtual display server on Linux OS.
|
89
|
+
xvfb_metrics=None, # Set Xvfb display size on Linux: "Width,Height".
|
86
90
|
start_page=None, # The starting URL for the web browser when tests begin.
|
87
91
|
rec_print=None, # If Recorder is enabled, prints output after tests end.
|
88
92
|
rec_behave=None, # Like Recorder Mode, but also generates behave-gherkin.
|
@@ -124,6 +128,125 @@ def SB(
|
|
124
128
|
interval=None, # SECONDS (Autoplay interval for SB Slides & Tour steps.)
|
125
129
|
time_limit=None, # SECONDS (Safely fail tests that exceed the time limit.)
|
126
130
|
):
|
131
|
+
"""
|
132
|
+
* SeleniumBase as a Python Context Manager *
|
133
|
+
|
134
|
+
Example:
|
135
|
+
--------
|
136
|
+
.. code-block:: python
|
137
|
+
from seleniumbase import SB
|
138
|
+
|
139
|
+
with SB() as sb: # Many args! Eg. SB(browser="edge")
|
140
|
+
sb.open("https://google.com/ncr")
|
141
|
+
sb.type('[name="q"]', "SeleniumBase on GitHub")
|
142
|
+
sb.submit('[name="q"]')
|
143
|
+
sb.click('a[href*="github.com/seleniumbase"]')
|
144
|
+
sb.highlight("div.Layout-main")
|
145
|
+
sb.highlight("div.Layout-sidebar")
|
146
|
+
sb.sleep(0.5)
|
147
|
+
|
148
|
+
Optional Parameters:
|
149
|
+
--------------------
|
150
|
+
test (bool): Test Mode: Output, Logging, Continue on failure unless "rtf".
|
151
|
+
rtf (bool): Shortcut / Duplicate of "raise_test_failure".
|
152
|
+
raise_test_failure (bool): If "test" mode, raise Exception on 1st failure.
|
153
|
+
browser (str): Choose from "chrome", "edge", "firefox", or "safari".
|
154
|
+
headless (bool): Use the default headless mode for Chromium and Firefox.
|
155
|
+
headless1 (bool): Use Chromium's old headless mode. (Fast, but limited)
|
156
|
+
headless2 (bool): Use Chromium's new headless mode. (Has more features)
|
157
|
+
locale_code (str): Set the Language Locale Code for the web browser.
|
158
|
+
protocol (str): The Selenium Grid protocol: "http" or "https".
|
159
|
+
servername (str): The Selenium Grid server/IP used for tests.
|
160
|
+
port (int): The Selenium Grid port used by the test server.
|
161
|
+
proxy (str): Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT".
|
162
|
+
proxy_bypass_list (str): Skip proxy when using the listed domains.
|
163
|
+
proxy_pac_url (str): Use PAC file. (Format: URL or USERNAME:PASSWORD@URL)
|
164
|
+
multi_proxy (bool): # Allow multiple proxies with auth when multithreaded.
|
165
|
+
agent (str): Modify the web browser's User-Agent string.
|
166
|
+
cap_file (str): The desired capabilities to use with a Selenium Grid.
|
167
|
+
cap_string (str): The desired capabilities to use with a Selenium Grid.
|
168
|
+
recorder_ext (bool): Enables the SeleniumBase Recorder Chromium extension.
|
169
|
+
disable_js (bool): Disable JavaScript on websites. Pages might break!
|
170
|
+
disable_csp (bool): Disable the Content Security Policy of websites.
|
171
|
+
enable_ws (bool): Enable Web Security on Chromium-based browsers.
|
172
|
+
enable_sync (bool): Enable "Chrome Sync" on websites.
|
173
|
+
use_auto_ext (bool): Use Chrome's automation extension.
|
174
|
+
undetectable (bool): Use undetected-chromedriver to evade bot-detection.
|
175
|
+
uc_cdp_events (bool): Capture CDP events in undetected-chromedriver mode.
|
176
|
+
uc_subprocess (bool): Use undetected-chromedriver as a subprocess.
|
177
|
+
log_cdp_events (bool): Capture {"performance": "ALL", "browser": "ALL"}
|
178
|
+
incognito (bool): Enable Chromium's Incognito mode.
|
179
|
+
guest_mode (bool): Enable Chromium's Guest mode.
|
180
|
+
dark_mode (bool): Enable Chromium's Dark mode.
|
181
|
+
devtools (bool): Open Chromium's DevTools when the browser opens.
|
182
|
+
remote_debug (bool): Enable Chrome's Debugger on "http://localhost:9222".
|
183
|
+
enable_3d_apis (bool): Enable WebGL and 3D APIs.
|
184
|
+
swiftshader (bool): Chrome: --use-gl=angle / --use-angle=swiftshader-webgl
|
185
|
+
ad_block_on (bool): Block some types of display ads from loading.
|
186
|
+
host_resolver_rules (str): Set host-resolver-rules, comma-separated.
|
187
|
+
block_images (bool): Block images from loading during tests.
|
188
|
+
do_not_track (bool): Tell websites that you don't want to be tracked.
|
189
|
+
chromium_arg (str): "ARG=N,ARG2" (Set Chromium args, ","-separated.)
|
190
|
+
firefox_arg (str): "ARG=N,ARG2" (Set Firefox args, comma-separated.)
|
191
|
+
firefox_pref (str): SET (Set Firefox PREFERENCE:VALUE set, ","-separated)
|
192
|
+
user_data_dir (str): Set the Chrome user data directory to use.
|
193
|
+
extension_zip (str): Load a Chrome Extension .zip|.crx, comma-separated.
|
194
|
+
extension_dir (str): Load a Chrome Extension directory, comma-separated.
|
195
|
+
disable_features (str): "F1,F2" (Disable Chrome features, ","-separated.)
|
196
|
+
binary_location (str): Set path of the Chromium browser binary to use.
|
197
|
+
driver_version (str): Set the chromedriver or uc_driver version to use.
|
198
|
+
skip_js_waits (bool): Skip JS Waits (readyState=="complete" and Angular).
|
199
|
+
wait_for_angularjs (bool): Wait for AngularJS to load after some actions.
|
200
|
+
use_wire (bool): Use selenium-wire's webdriver over selenium webdriver.
|
201
|
+
external_pdf (bool): Set Chrome "plugins.always_open_pdf_externally":True.
|
202
|
+
window_position (x,y): Set the browser's starting window position: "X,Y"
|
203
|
+
window_size (w,h): Set the browser's starting window size: "Width,Height"
|
204
|
+
is_mobile (bool): Use the mobile device emulator while running tests.
|
205
|
+
mobile (bool): Shortcut / Duplicate of "is_mobile".
|
206
|
+
device_metrics (w,h,pr): Mobile metrics: "CSSWidth,CSSHeight,PixelRatio"
|
207
|
+
xvfb (bool): Run tests using the Xvfb virtual display server on Linux OS.
|
208
|
+
xvfb_metrics (w,h): Set Xvfb display size on Linux: "Width,Height".
|
209
|
+
start_page (str): The starting URL for the web browser when tests begin.
|
210
|
+
rec_print (bool): If Recorder is enabled, prints output after tests end.
|
211
|
+
rec_behave (bool): Like Recorder Mode, but also generates behave-gherkin.
|
212
|
+
record_sleep (bool): If Recorder enabled, also records self.sleep calls.
|
213
|
+
data (str): Extra test data. Access with "self.data" in tests.
|
214
|
+
var1 (str): Extra test data. Access with "self.var1" in tests.
|
215
|
+
var2 (str): Extra test data. Access with "self.var2" in tests.
|
216
|
+
var3 (str): Extra test data. Access with "self.var3" in tests.
|
217
|
+
variables (dict): Extra test data. Access with "self.variables".
|
218
|
+
account (str): Set account. Access with "self.account" in tests.
|
219
|
+
environment (str): Set the test env. Access with "self.env" in tests.
|
220
|
+
headed (bool): Run tests in headed/GUI mode on Linux, where not default.
|
221
|
+
maximize (bool): Start tests with the browser window maximized.
|
222
|
+
disable_ws (bool): Reverse of "enable_ws". (None and False are different)
|
223
|
+
disable_beforeunload (bool): Disable the "beforeunload" event on Chromium.
|
224
|
+
settings_file (str): A file for overriding default SeleniumBase settings.
|
225
|
+
uc (bool): Shortcut / Duplicate of "undetectable".
|
226
|
+
undetected (bool): Shortcut / Duplicate of "undetectable".
|
227
|
+
uc_cdp (bool): Shortcut / Duplicate of "uc_cdp_events".
|
228
|
+
uc_sub (bool): Shortcut / Duplicate of "uc_subprocess".
|
229
|
+
log_cdp (bool): Shortcut / Duplicate of "log_cdp_events".
|
230
|
+
ad_block (bool): Shortcut / Duplicate of "ad_block_on".
|
231
|
+
server (str): Shortcut / Duplicate of "servername".
|
232
|
+
guest (bool): Shortcut / Duplicate of "guest_mode".
|
233
|
+
wire (bool): Shortcut / Duplicate of "use_wire".
|
234
|
+
pls (str): Shortcut / Duplicate of "page_load_strategy".
|
235
|
+
sjw (bool): Shortcut / Duplicate of "skip_js_waits".
|
236
|
+
wfa (bool): Shortcut / Duplicate of "wait_for_angularjs".
|
237
|
+
save_screenshot (bool): Save a screenshot at the end of each test.
|
238
|
+
no_screenshot (bool): No screenshots saved unless tests directly ask it.
|
239
|
+
page_load_strategy (str): Set Chrome PLS to "normal", "eager", or "none".
|
240
|
+
timeout_multiplier (float): Multiplies the default timeout values.
|
241
|
+
js_checking_on (bool): Check for JavaScript errors after page loads.
|
242
|
+
slow (bool): Slow down the automation. Faster than using Demo Mode.
|
243
|
+
demo (bool): Slow down and visually see test actions as they occur.
|
244
|
+
demo_sleep (float): SECONDS (Set wait time after Slow & Demo Mode actions)
|
245
|
+
message_duration (float): SECONDS (The time length for Messenger alerts.)
|
246
|
+
highlights (int): Number of highlight animations for Demo Mode actions.
|
247
|
+
interval (float): SECONDS (Autoplay interval for SB Slides & Tour steps.)
|
248
|
+
time_limit (float): SECONDS (Safely fail tests that exceed the time limit)
|
249
|
+
"""
|
127
250
|
import os
|
128
251
|
import sys
|
129
252
|
import time
|
@@ -280,6 +403,13 @@ def SB(
|
|
280
403
|
headless = True
|
281
404
|
else:
|
282
405
|
headless = False
|
406
|
+
if headless1 is None:
|
407
|
+
if "--headless1" in sys_argv:
|
408
|
+
headless1 = True
|
409
|
+
else:
|
410
|
+
headless1 = False
|
411
|
+
if headless1:
|
412
|
+
headless = True
|
283
413
|
if headless2 is None:
|
284
414
|
if "--headless2" in sys_argv:
|
285
415
|
headless2 = True
|
@@ -365,6 +495,48 @@ def SB(
|
|
365
495
|
break
|
366
496
|
count += 1
|
367
497
|
disable_features = d_f
|
498
|
+
w_p = window_position
|
499
|
+
if w_p is None and "--window-position" in arg_join:
|
500
|
+
count = 0
|
501
|
+
for arg in sys_argv:
|
502
|
+
if arg.startswith("--window-position="):
|
503
|
+
w_p = arg.split("--window-position=")[1]
|
504
|
+
break
|
505
|
+
elif arg == "--window-position" and len(sys_argv) > count + 1:
|
506
|
+
w_p = sys_argv[count + 1]
|
507
|
+
if w_p.startswith("-"):
|
508
|
+
w_p = None
|
509
|
+
break
|
510
|
+
count += 1
|
511
|
+
window_position = w_p
|
512
|
+
w_s = window_size
|
513
|
+
if w_s is None and "--window-size" in arg_join:
|
514
|
+
count = 0
|
515
|
+
for arg in sys_argv:
|
516
|
+
if arg.startswith("--window-size="):
|
517
|
+
w_s = arg.split("--window-size=")[1]
|
518
|
+
break
|
519
|
+
elif arg == "--window-size" and len(sys_argv) > count + 1:
|
520
|
+
w_s = sys_argv[count + 1]
|
521
|
+
if w_s.startswith("-"):
|
522
|
+
w_s = None
|
523
|
+
break
|
524
|
+
count += 1
|
525
|
+
window_size = w_s
|
526
|
+
x_m = xvfb_metrics
|
527
|
+
if x_m is None and "--xvfb-metrics" in arg_join:
|
528
|
+
count = 0
|
529
|
+
for arg in sys_argv:
|
530
|
+
if arg.startswith("--xvfb-metrics="):
|
531
|
+
x_m = arg.split("--xvfb-metrics=")[1]
|
532
|
+
break
|
533
|
+
elif arg == "--xvfb-metrics" and len(sys_argv) > count + 1:
|
534
|
+
x_m = sys_argv[count + 1]
|
535
|
+
if x_m.startswith("-"):
|
536
|
+
x_m = None
|
537
|
+
break
|
538
|
+
count += 1
|
539
|
+
xvfb_metrics = x_m
|
368
540
|
if agent is None and "--agent" in arg_join:
|
369
541
|
count = 0
|
370
542
|
for arg in sys_argv:
|
@@ -509,6 +681,7 @@ def SB(
|
|
509
681
|
recorder_ext = True
|
510
682
|
if recorder_mode and headless:
|
511
683
|
headless = False
|
684
|
+
headless1 = False
|
512
685
|
headless2 = True
|
513
686
|
sb_config.proxy_driver = False
|
514
687
|
if "--proxy-driver" in sys_argv or "--proxy_driver" in sys_argv:
|
@@ -638,6 +811,7 @@ def SB(
|
|
638
811
|
save_screenshot = False # "no_screenshot" has priority
|
639
812
|
if browser == "safari" and headless:
|
640
813
|
headless = False # Safari doesn't support headless mode
|
814
|
+
headless1 = False
|
641
815
|
if js_checking_on is None:
|
642
816
|
if "--check-js" in sys_argv:
|
643
817
|
js_checking_on = True
|
@@ -758,9 +932,11 @@ def SB(
|
|
758
932
|
sb_config.is_nosetest = False
|
759
933
|
sb_config.is_context_manager = True
|
760
934
|
sb_config.headless = headless
|
935
|
+
sb_config.headless1 = headless1
|
761
936
|
sb_config.headless2 = headless2
|
762
937
|
sb_config.headed = headed
|
763
938
|
sb_config.xvfb = xvfb
|
939
|
+
sb_config.xvfb_metrics = xvfb_metrics
|
764
940
|
sb_config.start_page = start_page
|
765
941
|
sb_config.locale_code = locale_code
|
766
942
|
sb_config.protocol = protocol
|
@@ -803,7 +979,8 @@ def SB(
|
|
803
979
|
sb_config.crumbs = False
|
804
980
|
sb_config.final_debug = False
|
805
981
|
sb_config.visual_baseline = False
|
806
|
-
sb_config.
|
982
|
+
sb_config.window_position = window_position
|
983
|
+
sb_config.window_size = window_size
|
807
984
|
sb_config.maximize_option = maximize_option
|
808
985
|
sb_config._disable_beforeunload = _disable_beforeunload
|
809
986
|
sb_config.save_screenshot = save_screenshot
|
@@ -861,9 +1038,11 @@ def SB(
|
|
861
1038
|
sb.is_nosetest = False
|
862
1039
|
sb.is_context_manager = sb_config.is_context_manager
|
863
1040
|
sb.headless = sb_config.headless
|
1041
|
+
sb.headless1 = sb_config.headless1
|
864
1042
|
sb.headless2 = sb_config.headless2
|
865
1043
|
sb.headed = sb_config.headed
|
866
1044
|
sb.xvfb = sb_config.xvfb
|
1045
|
+
sb.xvfb_metrics = sb_config.xvfb_metrics
|
867
1046
|
sb.start_page = sb_config.start_page
|
868
1047
|
sb.locale_code = sb_config.locale_code
|
869
1048
|
sb.protocol = sb_config.protocol
|
@@ -908,6 +1087,7 @@ def SB(
|
|
908
1087
|
sb._crumbs = sb_config.crumbs
|
909
1088
|
sb._final_debug = sb_config.final_debug
|
910
1089
|
sb.visual_baseline = sb_config.visual_baseline
|
1090
|
+
sb.window_position = sb_config.window_position
|
911
1091
|
sb.window_size = sb_config.window_size
|
912
1092
|
sb.maximize_option = sb_config.maximize_option
|
913
1093
|
sb._disable_beforeunload = sb_config._disable_beforeunload
|