seleniumbase 4.31.0__py3-none-any.whl → 4.31.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
1
  # seleniumbase package
2
- __version__ = "4.31.0"
2
+ __version__ = "4.31.1"
@@ -44,8 +44,9 @@ behave -D agent="User Agent String" -D demo
44
44
  -D sjw (Skip JS Waits for readyState to be "complete" or Angular to load.)
45
45
  -D wfa (Wait for AngularJS to be done loading after specific web actions.)
46
46
  -D pls=PLS (Set pageLoadStrategy on Chrome: "normal", "eager", or "none".)
47
- -D headless (Run tests in headless mode. The default arg on Linux OS.)
48
- -D headless2 (Use the new headless mode, which supports extensions.)
47
+ -D headless (The default headless mode. Linux uses this mode by default.)
48
+ -D headless1 (Use Chrome's old headless mode. Fast, but has limitations.)
49
+ -D headless2 (Use Chrome's new headless mode, which supports extensions.)
49
50
  -D headed (Run tests in headed/GUI mode on Linux OS, where not default.)
50
51
  -D xvfb (Run tests using the Xvfb virtual display server on Linux OS.)
51
52
  -D xvfb-metrics=STRING (Set Xvfb display size on Linux: "Width,Height".)
@@ -144,6 +145,7 @@ def get_configured_sb(context):
144
145
  sb.browser = "chrome"
145
146
  sb.is_behave = True
146
147
  sb.headless = False
148
+ sb.headless1 = False
147
149
  sb.headless2 = False
148
150
  sb.headless_active = False
149
151
  sb.headed = False
@@ -296,6 +298,11 @@ def get_configured_sb(context):
296
298
  sb.headless = True
297
299
  continue
298
300
  # Handle: -D headless2
301
+ if low_key == "headless1":
302
+ sb.headless1 = True
303
+ sb.headless = True
304
+ continue
305
+ # Handle: -D headless2
299
306
  if low_key == "headless2":
300
307
  sb.headless2 = True
301
308
  continue
@@ -864,6 +871,7 @@ def get_configured_sb(context):
864
871
  # Recorder Mode can still optimize scripts in "-D headless2" mode.
865
872
  if sb.recorder_ext and sb.headless:
866
873
  sb.headless = False
874
+ sb.headless1 = False
867
875
  sb.headless2 = True
868
876
  if sb.headless2 and sb.browser == "firefox":
869
877
  sb.headless2 = False # Only for Chromium browsers
@@ -900,11 +908,13 @@ def get_configured_sb(context):
900
908
  # Recorder Mode can still optimize scripts in --headless2 mode.
901
909
  if sb.recorder_mode and sb.headless:
902
910
  sb.headless = False
911
+ sb.headless1 = False
903
912
  sb.headless2 = True
904
913
  if not sb.headless and not sb.headless2:
905
914
  sb.headed = True
906
915
  if sb.browser == "safari" and sb.headless:
907
916
  sb.headless = False # Safari doesn't support headless mode
917
+ sb.headless1 = False
908
918
  if sb.save_screenshot_after_test and sb.no_screenshot_after_test:
909
919
  sb.save_screenshot_after_test = False # "no_screenshot" has priority
910
920
  if sb.servername != "localhost":
@@ -3,7 +3,9 @@
3
3
  http://www.patorjk.com/software/taag/#p=display&f=Slant&t=SeleniumBase """
4
4
 
5
5
  import colorama
6
+ import os
6
7
  import sys
8
+ from contextlib import suppress
7
9
 
8
10
  r"""
9
11
  ______ __ _ ____
@@ -66,4 +68,49 @@ def get_seleniumbase_logo():
66
68
  sb += " "
67
69
  sb += cr
68
70
  sb += cr
71
+ with suppress(Exception):
72
+ terminal_width = os.get_terminal_size().columns
73
+ if isinstance(terminal_width, int) and terminal_width >= 66:
74
+ return sb
75
+
76
+ # If the logo is wider than the screen width, use a smaller one:
77
+ r"""
78
+ ___ _ _ ___
79
+ / __| ___| |___ _ _ (_)_ _ _ __ | _ ) __ _ ______
80
+ \__ \/ -_) / -_) ' \| | \| | ' \ | _ \/ _` (_-< -_)
81
+ |___/\___|_\___|_||_|_|\_,_|_|_|_\|___/\__,_/__|___|
82
+ """
83
+ sb = " "
84
+ sb += cr
85
+ sb += "\n"
86
+ sb += c1
87
+ sb += " ___ _ _ "
88
+ sb += c2
89
+ sb += " ___ "
90
+ sb += cr
91
+ sb += "\n"
92
+ sb += c1
93
+ sb += "/ __| ___| |___ _ _ (_)_ _ _ __ "
94
+ sb += c2
95
+ sb += "| _ ) __ _ ______ "
96
+ sb += cr
97
+ sb += "\n"
98
+ sb += c1
99
+ sb += "\\__ \\/ -_) / -_) ' \\| | \\| | ' \\ "
100
+ sb += c2
101
+ sb += "| _ \\/ _` (_-< -_)"
102
+ sb += cr
103
+ sb += "\n"
104
+ sb += c1
105
+ sb += "|___/\\___|_\\___|_||_|_|\\_,_|_|_|_\\"
106
+ sb += c2
107
+ sb += "|___/\\__,_/__|___|"
108
+ sb += cr
109
+ sb += "\n"
110
+ sb += c3
111
+ sb += " "
112
+ sb += c4
113
+ sb += " "
114
+ sb += cr
115
+ sb += cr
69
116
  return sb
@@ -54,8 +54,8 @@ else:
54
54
  def show_usage():
55
55
  show_basic_usage()
56
56
  sc = ""
57
- sc += ' Type "sbase help [COMMAND]" for specific command info.\n'
58
- sc += ' For info on all commands, type: "seleniumbase --help".\n'
57
+ sc += ' Type "sbase help [COMMAND]" for specific info.\n'
58
+ sc += ' For all commands, type: "seleniumbase --help".\n'
59
59
  sc += ' Use "pytest" for running tests.\n'
60
60
  if "linux" not in sys.platform:
61
61
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
@@ -76,12 +76,15 @@ def show_basic_usage():
76
76
 
77
77
  seleniumbase_logo = logo_helper.get_seleniumbase_logo()
78
78
  print(seleniumbase_logo)
79
+ time.sleep(0.044)
79
80
  print("")
80
- time.sleep(0.28) # Enough time to see the logo
81
+ time.sleep(0.033)
81
82
  show_package_location()
83
+ time.sleep(0.032)
82
84
  show_version_info()
85
+ time.sleep(0.031)
83
86
  print("")
84
- time.sleep(0.62) # Enough time to see the version
87
+ time.sleep(0.68) # Enough time to see the logo & version
85
88
  sc = ""
86
89
  sc += ' * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"\n'
87
90
  sc += ' * OR: "sbase [COMMAND] [PARAMETERS]"\n'
@@ -203,6 +203,8 @@ def extend_driver(driver):
203
203
  driver.is_exact_text_visible = DM.is_exact_text_visible
204
204
  driver.is_attribute_present = DM.is_attribute_present
205
205
  driver.is_non_empty_text_visible = DM.is_non_empty_text_visible
206
+ driver.is_valid_url = DM.is_valid_url
207
+ driver.is_alert_present = DM.is_alert_present
206
208
  driver.is_online = DM.is_online
207
209
  driver.js_click = DM.js_click
208
210
  driver.get_text = DM.get_text
@@ -1553,6 +1555,7 @@ def _set_chrome_options(
1553
1555
  log_cdp_events,
1554
1556
  no_sandbox,
1555
1557
  disable_gpu,
1558
+ headless1,
1556
1559
  headless2,
1557
1560
  incognito,
1558
1561
  guest_mode,
@@ -1771,7 +1774,10 @@ def _set_chrome_options(
1771
1774
  pass # Processed After Version Check
1772
1775
  elif headless:
1773
1776
  if not undetectable:
1774
- chrome_options.add_argument("--headless")
1777
+ if headless1:
1778
+ chrome_options.add_argument("--headless=old")
1779
+ else:
1780
+ chrome_options.add_argument("--headless")
1775
1781
  if undetectable and servername and servername != "localhost":
1776
1782
  # The Grid Node will need Chrome 109 or newer
1777
1783
  chrome_options.add_argument("--headless=new")
@@ -2193,6 +2199,7 @@ def get_driver(
2193
2199
  log_cdp_events=False,
2194
2200
  no_sandbox=False,
2195
2201
  disable_gpu=False,
2202
+ headless1=False,
2196
2203
  headless2=False,
2197
2204
  incognito=False,
2198
2205
  guest_mode=False,
@@ -2406,6 +2413,7 @@ def get_driver(
2406
2413
  log_cdp_events,
2407
2414
  no_sandbox,
2408
2415
  disable_gpu,
2416
+ headless1,
2409
2417
  headless2,
2410
2418
  incognito,
2411
2419
  guest_mode,
@@ -2462,6 +2470,7 @@ def get_driver(
2462
2470
  log_cdp_events,
2463
2471
  no_sandbox,
2464
2472
  disable_gpu,
2473
+ headless1,
2465
2474
  headless2,
2466
2475
  incognito,
2467
2476
  guest_mode,
@@ -2522,6 +2531,7 @@ def get_remote_driver(
2522
2531
  log_cdp_events,
2523
2532
  no_sandbox,
2524
2533
  disable_gpu,
2534
+ headless1,
2525
2535
  headless2,
2526
2536
  incognito,
2527
2537
  guest_mode,
@@ -2657,6 +2667,7 @@ def get_remote_driver(
2657
2667
  log_cdp_events,
2658
2668
  no_sandbox,
2659
2669
  disable_gpu,
2670
+ headless1,
2660
2671
  headless2,
2661
2672
  incognito,
2662
2673
  guest_mode,
@@ -2829,6 +2840,7 @@ def get_remote_driver(
2829
2840
  log_cdp_events,
2830
2841
  no_sandbox,
2831
2842
  disable_gpu,
2843
+ headless1,
2832
2844
  headless2,
2833
2845
  incognito,
2834
2846
  guest_mode,
@@ -2948,6 +2960,7 @@ def get_local_driver(
2948
2960
  log_cdp_events,
2949
2961
  no_sandbox,
2950
2962
  disable_gpu,
2963
+ headless1,
2951
2964
  headless2,
2952
2965
  incognito,
2953
2966
  guest_mode,
@@ -3425,8 +3438,14 @@ def get_local_driver(
3425
3438
  else:
3426
3439
  pass # Will need Xvfb on Linux
3427
3440
  elif headless:
3428
- if "--headless" not in edge_options.arguments:
3429
- edge_options.add_argument("--headless")
3441
+ if (
3442
+ "--headless" not in edge_options.arguments
3443
+ and "--headless=old" not in edge_options.arguments
3444
+ ):
3445
+ if headless1:
3446
+ edge_options.add_argument("--headless=old")
3447
+ else:
3448
+ edge_options.add_argument("--headless")
3430
3449
  if mobile_emulator and not is_using_uc(undetectable, browser_name):
3431
3450
  emulator_settings = {}
3432
3451
  device_metrics = {}
@@ -3788,6 +3807,7 @@ def get_local_driver(
3788
3807
  log_cdp_events,
3789
3808
  no_sandbox,
3790
3809
  disable_gpu,
3810
+ headless1,
3791
3811
  headless2,
3792
3812
  incognito,
3793
3813
  guest_mode,
@@ -3960,8 +3980,14 @@ def get_local_driver(
3960
3980
  except Exception:
3961
3981
  pass # Will need Xvfb on Linux
3962
3982
  elif headless:
3963
- if "--headless" not in chrome_options.arguments:
3964
- chrome_options.add_argument("--headless")
3983
+ if (
3984
+ "--headless" not in chrome_options.arguments
3985
+ and "--headless=old" not in chrome_options.arguments
3986
+ ):
3987
+ if headless1:
3988
+ chrome_options.add_argument("--headless=old")
3989
+ else:
3990
+ chrome_options.add_argument("--headless")
3965
3991
  if LOCAL_CHROMEDRIVER and os.path.exists(LOCAL_CHROMEDRIVER):
3966
3992
  try:
3967
3993
  make_driver_executable_if_not(LOCAL_CHROMEDRIVER)
@@ -4227,6 +4253,12 @@ def get_local_driver(
4227
4253
  chrome_options.arguments.remove(
4228
4254
  "--headless"
4229
4255
  )
4256
+ if "--headless=old" in (
4257
+ chrome_options.arguments
4258
+ ):
4259
+ chrome_options.arguments.remove(
4260
+ "--headless=old"
4261
+ )
4230
4262
  uc_chrome_version = None
4231
4263
  if (
4232
4264
  use_version.isnumeric()
@@ -4300,6 +4332,7 @@ def get_local_driver(
4300
4332
  False, # log_cdp_events
4301
4333
  no_sandbox,
4302
4334
  disable_gpu,
4335
+ False, # headless1
4303
4336
  False, # headless2
4304
4337
  incognito,
4305
4338
  guest_mode,
@@ -4541,6 +4574,7 @@ def get_local_driver(
4541
4574
  False, # log_cdp_events
4542
4575
  no_sandbox,
4543
4576
  disable_gpu,
4577
+ False, # headless1
4544
4578
  False, # headless2
4545
4579
  incognito,
4546
4580
  guest_mode,
@@ -4792,6 +4826,8 @@ def get_local_driver(
4792
4826
  )
4793
4827
  if "--headless" in chrome_options.arguments:
4794
4828
  chrome_options.arguments.remove("--headless")
4829
+ if "--headless=old" in chrome_options.arguments:
4830
+ chrome_options.arguments.remove("--headless=old")
4795
4831
  service = ChromeService(
4796
4832
  log_output=os.devnull,
4797
4833
  service_args=["--disable-build-check"]
@@ -161,6 +161,17 @@ class DriverMethods():
161
161
  self.driver, *args, **kwargs
162
162
  )
163
163
 
164
+ def is_valid_url(self, url):
165
+ """Return True if the url is a valid url."""
166
+ return page_utils.is_valid_url(url)
167
+
168
+ def is_alert_present(self):
169
+ try:
170
+ self.driver.switch_to.alert
171
+ return True
172
+ except Exception:
173
+ return False
174
+
164
175
  def is_online(self):
165
176
  return self.driver.execute_script("return navigator.onLine;")
166
177
 
@@ -3771,6 +3771,7 @@ class BaseCase(unittest.TestCase):
3771
3771
  log_cdp_events=None,
3772
3772
  no_sandbox=None,
3773
3773
  disable_gpu=None,
3774
+ headless1=None,
3774
3775
  headless2=None,
3775
3776
  incognito=None,
3776
3777
  guest_mode=None,
@@ -3830,6 +3831,7 @@ class BaseCase(unittest.TestCase):
3830
3831
  log_cdp_events - capture {"performance": "ALL", "browser": "ALL"})
3831
3832
  no_sandbox - the option to enable the "No-Sandbox" feature (Chrome)
3832
3833
  disable_gpu - the option to enable Chrome's "Disable GPU" feature
3834
+ headless1 - the option to use the older headless mode (Chromium)
3833
3835
  headless2 - the option to use the newer headless mode (Chromium)
3834
3836
  incognito - the option to enable Chrome's Incognito mode (Chrome)
3835
3837
  guest_mode - the option to enable Chrome's Guest mode (Chrome)
@@ -3938,6 +3940,8 @@ class BaseCase(unittest.TestCase):
3938
3940
  no_sandbox = self.no_sandbox
3939
3941
  if disable_gpu is None:
3940
3942
  disable_gpu = self.disable_gpu
3943
+ if headless1 is None:
3944
+ headless1 = self.headless1
3941
3945
  if headless2 is None:
3942
3946
  headless2 = self.headless2
3943
3947
  if incognito is None:
@@ -4036,6 +4040,7 @@ class BaseCase(unittest.TestCase):
4036
4040
  log_cdp_events=log_cdp_events,
4037
4041
  no_sandbox=no_sandbox,
4038
4042
  disable_gpu=disable_gpu,
4043
+ headless1=headless1,
4039
4044
  headless2=headless2,
4040
4045
  incognito=incognito,
4041
4046
  guest_mode=guest_mode,
@@ -7808,6 +7813,13 @@ class BaseCase(unittest.TestCase):
7808
7813
  """Return True if the url is a valid url."""
7809
7814
  return page_utils.is_valid_url(url)
7810
7815
 
7816
+ def is_alert_present(self):
7817
+ try:
7818
+ self.driver.switch_to.alert
7819
+ return True
7820
+ except Exception:
7821
+ return False
7822
+
7811
7823
  def is_online(self):
7812
7824
  """Return True if connected to the Internet."""
7813
7825
  return self.execute_script("return navigator.onLine;")
@@ -14324,6 +14336,10 @@ class BaseCase(unittest.TestCase):
14324
14336
  self.env = self.environment # Add a shortened version
14325
14337
  self.with_selenium = sb_config.with_selenium # Should be True
14326
14338
  self.headless = sb_config.headless
14339
+ self.headless1 = sb_config.headless1
14340
+ if self.headless1:
14341
+ self.headless = True
14342
+ self.headless2 = sb_config.headless2
14327
14343
  self.headless_active = False
14328
14344
  sb_config.headless_active = False
14329
14345
  self.headed = sb_config.headed
@@ -14392,7 +14408,6 @@ class BaseCase(unittest.TestCase):
14392
14408
  self.log_cdp_events = sb_config.log_cdp_events
14393
14409
  self.no_sandbox = sb_config.no_sandbox
14394
14410
  self.disable_gpu = sb_config.disable_gpu
14395
- self.headless2 = sb_config.headless2
14396
14411
  self.incognito = sb_config.incognito
14397
14412
  self.guest_mode = sb_config.guest_mode
14398
14413
  self.dark_mode = sb_config.dark_mode
@@ -14768,6 +14783,7 @@ class BaseCase(unittest.TestCase):
14768
14783
  log_cdp_events=self.log_cdp_events,
14769
14784
  no_sandbox=self.no_sandbox,
14770
14785
  disable_gpu=self.disable_gpu,
14786
+ headless1=self.headless1,
14771
14787
  headless2=self.headless2,
14772
14788
  incognito=self.incognito,
14773
14789
  guest_mode=self.guest_mode,
@@ -163,12 +163,15 @@ def is_valid_url(url):
163
163
  r"(?:/?|[/?]\S+)$",
164
164
  re.IGNORECASE,
165
165
  )
166
- return (
166
+ if (
167
167
  regex.match(url)
168
168
  or url.startswith((
169
169
  "about:", "blob:", "chrome:", "data:", "edge:", "file:"
170
170
  ))
171
- )
171
+ ):
172
+ return True
173
+ else:
174
+ return False
172
175
 
173
176
 
174
177
  def _get_unique_links(page_url, soup):
@@ -65,8 +65,9 @@ class DriverContext():
65
65
 
66
66
  def Driver(
67
67
  browser=None, # Choose from "chrome", "edge", "firefox", or "safari".
68
- headless=None, # The original headless mode for Chromium and Firefox.
69
- headless2=None, # Chromium's new headless mode. (Has more features)
68
+ headless=None, # Use the default headless mode for Chromium and Firefox.
69
+ headless1=None, # Use Chromium's old headless mode. (Fast, but limited)
70
+ headless2=None, # Use Chromium's new headless mode. (Has more features)
70
71
  headed=None, # Run tests in headed/GUI mode on Linux, where not default.
71
72
  locale_code=None, # Set the Language Locale Code for the web browser.
72
73
  protocol=None, # The Selenium Grid protocol: "http" or "https".
@@ -154,74 +155,75 @@ def Driver(
154
155
 
155
156
  Optional Parameters:
156
157
  --------------------
157
- browser: # Choose from "chrome", "edge", "firefox", or "safari".
158
- headless: # The original headless mode for Chromium and Firefox.
159
- headless2: # Chromium's new headless mode. (Has more features)
160
- headed: # Run tests in headed/GUI mode on Linux, where not default.
161
- locale_code: # Set the Language Locale Code for the web browser.
162
- protocol: # The Selenium Grid protocol: "http" or "https".
163
- servername: # The Selenium Grid server/IP used for tests.
164
- port: # The Selenium Grid port used by the test server.
165
- proxy: # Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT".
166
- proxy_bypass_list: # Skip proxy when using the listed domains.
167
- proxy_pac_url: # Use PAC file. (Format: URL or USERNAME:PASSWORD@URL)
168
- multi_proxy: # Allow multiple proxies with auth when multi-threaded.
169
- agent: # Modify the web browser's User-Agent string.
170
- cap_file: # The desired capabilities to use with a Selenium Grid.
171
- cap_string: # The desired capabilities to use with a Selenium Grid.
172
- recorder_ext: # Enables the SeleniumBase Recorder Chromium extension.
173
- disable_js: # Disable JavaScript on websites. Pages might break!
174
- disable_csp: # Disable the Content Security Policy of websites.
175
- enable_ws: # Enable Web Security on Chromium-based browsers.
176
- disable_ws: # Reverse of "enable_ws". (None and False are different)
177
- enable_sync: # Enable "Chrome Sync" on websites.
178
- use_auto_ext: # Use Chrome's automation extension.
179
- undetectable: # Use undetected-chromedriver to evade bot-detection.
180
- uc_cdp_events: # Capture CDP events in undetected-chromedriver mode.
181
- uc_subprocess: # Use undetected-chromedriver as a subprocess.
182
- log_cdp_events: # Capture {"performance": "ALL", "browser": "ALL"}
183
- no_sandbox: # (DEPRECATED) - "--no-sandbox" is always used now.
184
- disable_gpu: # (DEPRECATED) - GPU is disabled if not "swiftshader".
185
- incognito: # Enable Chromium's Incognito mode.
186
- guest_mode: # Enable Chromium's Guest mode.
187
- dark_mode: # Enable Chromium's Dark mode.
188
- devtools: # Open Chromium's DevTools when the browser opens.
189
- remote_debug: # Enable Chrome's Debugger on "http://localhost:9222".
190
- enable_3d_apis: # Enable WebGL and 3D APIs.
191
- swiftshader: # Chrome: --use-gl=angle / --use-angle=swiftshader-webgl
192
- ad_block_on: # Block some types of display ads from loading.
193
- host_resolver_rules: # Set host-resolver-rules, comma-separated.
194
- block_images: # Block images from loading during tests.
195
- do_not_track: # Tell websites that you don't want to be tracked.
196
- chromium_arg: # "ARG=N,ARG2" (Set Chromium args, ","-separated.)
197
- firefox_arg: # "ARG=N,ARG2" (Set Firefox args, comma-separated.)
198
- firefox_pref: # SET (Set Firefox PREFERENCE:VALUE set, ","-separated)
199
- user_data_dir: # Set the Chrome user data directory to use.
200
- extension_zip: # Load a Chrome Extension .zip|.crx, comma-separated.
201
- extension_dir: # Load a Chrome Extension directory, comma-separated.
202
- disable_features: # "F1,F2" (Disable Chrome features, ","-separated.)
203
- binary_location: # Set path of the Chromium browser binary to use.
204
- driver_version: # Set the chromedriver or uc_driver version to use.
205
- page_load_strategy: # Set Chrome PLS to "normal", "eager", or "none".
206
- use_wire: # Use selenium-wire's webdriver over selenium webdriver.
207
- external_pdf: # Set Chrome "plugins.always_open_pdf_externally":True.
208
- window_position: # Set the browser's starting window position: "X,Y"
209
- window_size: # Set the browser's starting window size: "Width,Height"
210
- is_mobile: # Use the mobile device emulator while running tests.
211
- mobile: # Shortcut / Duplicate of "is_mobile".
212
- d_width: # Set device width
213
- d_height: # Set device height
214
- d_p_r: # Set device pixel ratio
215
- uc: # Shortcut / Duplicate of "undetectable".
216
- undetected: # Shortcut / Duplicate of "undetectable".
217
- uc_cdp: # Shortcut / Duplicate of "uc_cdp_events".
218
- uc_sub: # Shortcut / Duplicate of "uc_subprocess".
219
- log_cdp: # Shortcut / Duplicate of "log_cdp_events".
220
- ad_block: # Shortcut / Duplicate of "ad_block_on".
221
- server: # Shortcut / Duplicate of "servername".
222
- guest: # Shortcut / Duplicate of "guest_mode".
223
- wire: # Shortcut / Duplicate of "use_wire".
224
- pls: # Shortcut / Duplicate of "page_load_strategy".
158
+ browser (str): Choose from "chrome", "edge", "firefox", or "safari".
159
+ headless (bool): Use the default headless mode for Chromium and Firefox.
160
+ headless1 (bool): Use Chromium's old headless mode. (Fast, but limited)
161
+ headless2 (bool): Use Chromium's new headless mode. (Has more features)
162
+ headed (bool): Run tests in headed/GUI mode on Linux, where not default.
163
+ locale_code (str): Set the Language Locale Code for the web browser.
164
+ protocol (str): The Selenium Grid protocol: "http" or "https".
165
+ servername (str): The Selenium Grid server/IP used for tests.
166
+ port (int): The Selenium Grid port used by the test server.
167
+ proxy (str): Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT".
168
+ proxy_bypass_list (str): Skip proxy when using the listed domains.
169
+ proxy_pac_url (str): Use PAC file. (Format: URL or USERNAME:PASSWORD@URL)
170
+ multi_proxy (bool): Allow multiple proxies with auth when multi-threaded.
171
+ agent (str): Modify the web browser's User-Agent string.
172
+ cap_file (str): The desired capabilities to use with a Selenium Grid.
173
+ cap_string (str): The desired capabilities to use with a Selenium Grid.
174
+ recorder_ext (bool): Enables the SeleniumBase Recorder Chromium extension.
175
+ disable_js (bool): Disable JavaScript on websites. Pages might break!
176
+ disable_csp (bool): Disable the Content Security Policy of websites.
177
+ enable_ws (bool): Enable Web Security on Chromium-based browsers.
178
+ disable_ws (bool): Reverse of "enable_ws". (None and False are different)
179
+ enable_sync (bool): Enable "Chrome Sync" on websites.
180
+ use_auto_ext (bool): Use Chrome's automation extension.
181
+ undetectable (bool): Use undetected-chromedriver to evade bot-detection.
182
+ uc_cdp_events (bool): Capture CDP events in undetected-chromedriver mode.
183
+ uc_subprocess (bool): Use undetected-chromedriver as a subprocess.
184
+ log_cdp_events (bool): Capture {"performance": "ALL", "browser": "ALL"}
185
+ no_sandbox (bool): (DEPRECATED) - "--no-sandbox" is always used now.
186
+ disable_gpu (bool): (DEPRECATED) - GPU is disabled if not "swiftshader".
187
+ incognito (bool): Enable Chromium's Incognito mode.
188
+ guest_mode (bool): Enable Chromium's Guest mode.
189
+ dark_mode (bool): Enable Chromium's Dark mode.
190
+ devtools (bool): Open Chromium's DevTools when the browser opens.
191
+ remote_debug (bool): Enable Chrome's Debugger on "http://localhost:9222".
192
+ enable_3d_apis (bool): Enable WebGL and 3D APIs.
193
+ swiftshader (bool): Chrome: --use-gl=angle / --use-angle=swiftshader-webgl
194
+ ad_block_on (bool): Block some types of display ads from loading.
195
+ host_resolver_rules (str): Set host-resolver-rules, comma-separated.
196
+ block_images (bool): Block images from loading during tests.
197
+ do_not_track (bool): Tell websites that you don't want to be tracked.
198
+ chromium_arg (str): "ARG=N,ARG2" (Set Chromium args, ","-separated.)
199
+ firefox_arg (str): "ARG=N,ARG2" (Set Firefox args, comma-separated.)
200
+ firefox_pref (str): SET (Set Firefox PREFERENCE:VALUE set, ","-separated)
201
+ user_data_dir (str): Set the Chrome user data directory to use.
202
+ extension_zip (str): Load a Chrome Extension .zip|.crx, comma-separated.
203
+ extension_dir (str): Load a Chrome Extension directory, comma-separated.
204
+ disable_features (str): "F1,F2" (Disable Chrome features, ","-separated.)
205
+ binary_location (str): Set path of the Chromium browser binary to use.
206
+ driver_version (str): Set the chromedriver or uc_driver version to use.
207
+ page_load_strategy (str): Set Chrome PLS to "normal", "eager", or "none".
208
+ use_wire (bool): Use selenium-wire's webdriver over selenium webdriver.
209
+ external_pdf (bool): Set Chrome "plugins.always_open_pdf_externally":True
210
+ window_position (x,y): Set the browser's starting window position: "X,Y"
211
+ window_size (w,h): Set the browser's starting window size: "Width,Height"
212
+ is_mobile (bool): Use the mobile device emulator while running tests.
213
+ mobile (bool): Shortcut / Duplicate of "is_mobile".
214
+ d_width (int): Set device width
215
+ d_height (int): Set device height
216
+ d_p_r (float): Set device pixel ratio
217
+ uc (bool): Shortcut / Duplicate of "undetectable".
218
+ undetected (bool): Shortcut / Duplicate of "undetectable".
219
+ uc_cdp (bool): Shortcut / Duplicate of "uc_cdp_events".
220
+ uc_sub (bool): Shortcut / Duplicate of "uc_subprocess".
221
+ log_cdp (bool): Shortcut / Duplicate of "log_cdp_events".
222
+ ad_block (bool): Shortcut / Duplicate of "ad_block_on".
223
+ server (str): Shortcut / Duplicate of "servername".
224
+ guest (bool): Shortcut / Duplicate of "guest_mode".
225
+ wire (bool): Shortcut / Duplicate of "use_wire".
226
+ pls (str): Shortcut / Duplicate of "page_load_strategy".
225
227
  """
226
228
  from seleniumbase import config as sb_config
227
229
  from seleniumbase.config import settings
@@ -336,6 +338,13 @@ def Driver(
336
338
  headless = True
337
339
  else:
338
340
  headless = False
341
+ if headless1 is None:
342
+ if "--headless1" in sys_argv:
343
+ headless1 = True
344
+ else:
345
+ headless1 = False
346
+ if headless1:
347
+ headless = True
339
348
  if headless2 is None:
340
349
  if "--headless2" in sys_argv:
341
350
  headless2 = True
@@ -601,6 +610,7 @@ def Driver(
601
610
  headless = True
602
611
  if recorder_mode and headless:
603
612
  headless = False
613
+ headless1 = False
604
614
  headless2 = True
605
615
  if headless2 and browser == "firefox":
606
616
  headless2 = False # Only for Chromium browsers
@@ -773,6 +783,7 @@ def Driver(
773
783
  log_cdp_events=log_cdp_events,
774
784
  no_sandbox=no_sandbox,
775
785
  disable_gpu=disable_gpu,
786
+ headless1=headless1,
776
787
  headless2=headless2,
777
788
  incognito=incognito,
778
789
  guest_mode=guest_mode,
@@ -62,8 +62,9 @@ def pytest_addoption(parser):
62
62
  --sjw (Skip JS Waits for readyState to be "complete" or Angular to load.)
63
63
  --wfa (Wait for AngularJS to be done loading after specific web actions.)
64
64
  --pls=PLS (Set pageLoadStrategy on Chrome: "normal", "eager", or "none".)
65
- --headless (Run tests in headless mode. The default arg on Linux OS.)
66
- --headless2 (Use the new headless mode, which supports extensions.)
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.)
67
68
  --headed (Run tests in headed/GUI mode on Linux OS, where not default.)
68
69
  --xvfb (Run tests using the Xvfb virtual display server on Linux OS.)
69
70
  --xvfb-metrics=STRING (Set Xvfb display size on Linux: "Width,Height".)
@@ -700,6 +701,15 @@ def pytest_addoption(parser):
700
701
  UNLESS using a virtual display with Xvfb.
701
702
  Default: False on Mac/Windows. True on Linux.""",
702
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
+ )
703
713
  parser.addoption(
704
714
  "--headless2",
705
715
  action="store_true",
@@ -1533,6 +1543,9 @@ def pytest_configure(config):
1533
1543
  sb_config.mobile_emulator = config.getoption("mobile_emulator")
1534
1544
  sb_config.device_metrics = config.getoption("device_metrics")
1535
1545
  sb_config.headless = config.getoption("headless")
1546
+ sb_config.headless1 = config.getoption("headless1")
1547
+ if sb_config.headless1:
1548
+ sb_config.headless = True
1536
1549
  sb_config.headless2 = config.getoption("headless2")
1537
1550
  if sb_config.headless2 and sb_config.browser == "firefox":
1538
1551
  sb_config.headless2 = False # Only for Chromium browsers
@@ -1759,6 +1772,7 @@ def pytest_configure(config):
1759
1772
  # Recorder Mode can still optimize scripts in --headless2 mode.
1760
1773
  if sb_config.recorder_mode and sb_config.headless:
1761
1774
  sb_config.headless = False
1775
+ sb_config.headless1 = False
1762
1776
  sb_config.headless2 = True
1763
1777
 
1764
1778
  if not sb_config.headless and not sb_config.headless2:
@@ -1779,6 +1793,7 @@ def pytest_configure(config):
1779
1793
 
1780
1794
  if sb_config.browser == "safari" and sb_config.headless:
1781
1795
  sb_config.headless = False # Safari doesn't support headless mode
1796
+ sb_config.headless1 = False
1782
1797
 
1783
1798
  if sb_config.dash_title:
1784
1799
  constants.Dashboard.TITLE = sb_config.dash_title.replace("_", " ")
@@ -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, # The original headless mode for Chromium and Firefox.
36
- headless2=None, # Chromium's new headless mode. (Has more features)
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.
@@ -146,104 +147,105 @@ def SB(
146
147
 
147
148
  Optional Parameters:
148
149
  --------------------
149
- test: Test Mode: Output, Logging, Continue on failure unless "rtf".
150
- rtf: Shortcut / Duplicate of "raise_test_failure".
151
- raise_test_failure: If "test" mode, raise Exception on 1st failure.
152
- browser: Choose from "chrome", "edge", "firefox", or "safari".
153
- headless: The original headless mode for Chromium and Firefox.
154
- headless2: Chromium's new headless mode. (Has more features)
155
- locale_code: Set the Language Locale Code for the web browser.
156
- protocol: The Selenium Grid protocol: "http" or "https".
157
- servername: The Selenium Grid server/IP used for tests.
158
- port: The Selenium Grid port used by the test server.
159
- proxy: Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT".
160
- proxy_bypass_list: Skip proxy when using the listed domains.
161
- proxy_pac_url: Use PAC file. (Format: URL or USERNAME:PASSWORD@URL)
162
- multi_proxy: # Allow multiple proxies with auth when multi-threaded.
163
- agent: Modify the web browser's User-Agent string.
164
- cap_file: The desired capabilities to use with a Selenium Grid.
165
- cap_string: The desired capabilities to use with a Selenium Grid.
166
- recorder_ext: Enables the SeleniumBase Recorder Chromium extension.
167
- disable_js: Disable JavaScript on websites. Pages might break!
168
- disable_csp: Disable the Content Security Policy of websites.
169
- enable_ws: Enable Web Security on Chromium-based browsers.
170
- enable_sync: Enable "Chrome Sync" on websites.
171
- use_auto_ext: Use Chrome's automation extension.
172
- undetectable: Use undetected-chromedriver to evade bot-detection.
173
- uc_cdp_events: Capture CDP events in undetected-chromedriver mode.
174
- uc_subprocess: Use undetected-chromedriver as a subprocess.
175
- log_cdp_events: Capture {"performance": "ALL", "browser": "ALL"}
176
- incognito: Enable Chromium's Incognito mode.
177
- guest_mode: Enable Chromium's Guest mode.
178
- dark_mode: Enable Chromium's Dark mode.
179
- devtools: Open Chromium's DevTools when the browser opens.
180
- remote_debug: Enable Chrome's Debugger on "http://localhost:9222".
181
- enable_3d_apis: Enable WebGL and 3D APIs.
182
- swiftshader: Chrome: --use-gl=angle / --use-angle=swiftshader-webgl
183
- ad_block_on: Block some types of display ads from loading.
184
- host_resolver_rules: Set host-resolver-rules, comma-separated.
185
- block_images: Block images from loading during tests.
186
- do_not_track: Tell websites that you don't want to be tracked.
187
- chromium_arg: "ARG=N,ARG2" (Set Chromium args, ","-separated.)
188
- firefox_arg: "ARG=N,ARG2" (Set Firefox args, comma-separated.)
189
- firefox_pref: SET (Set Firefox PREFERENCE:VALUE set, ","-separated)
190
- user_data_dir: Set the Chrome user data directory to use.
191
- extension_zip: Load a Chrome Extension .zip|.crx, comma-separated.
192
- extension_dir: Load a Chrome Extension directory, comma-separated.
193
- disable_features: "F1,F2" (Disable Chrome features, ","-separated.)
194
- binary_location: Set path of the Chromium browser binary to use.
195
- driver_version: Set the chromedriver or uc_driver version to use.
196
- skip_js_waits: Skip JS Waits (readyState=="complete" and Angular).
197
- wait_for_angularjs: Wait for AngularJS to load after some actions.
198
- use_wire: Use selenium-wire's webdriver over selenium webdriver.
199
- external_pdf: Set Chrome "plugins.always_open_pdf_externally":True.
200
- window_position: Set the browser's starting window position: "X,Y"
201
- window_size: Set the browser's starting window size: "Width,Height"
202
- is_mobile: Use the mobile device emulator while running tests.
203
- mobile: Shortcut / Duplicate of "is_mobile".
204
- device_metrics: Set mobile metrics: "CSSWidth,CSSHeight,PixelRatio"
205
- xvfb: Run tests using the Xvfb virtual display server on Linux OS.
206
- xvfb_metrics: Set Xvfb display size on Linux: "Width,Height".
207
- start_page: The starting URL for the web browser when tests begin.
208
- rec_print: If Recorder is enabled, prints output after tests end.
209
- rec_behave: Like Recorder Mode, but also generates behave-gherkin.
210
- record_sleep: If Recorder enabled, also records self.sleep calls.
211
- data: Extra test data. Access with "self.data" in tests.
212
- var1: Extra test data. Access with "self.var1" in tests.
213
- var2: Extra test data. Access with "self.var2" in tests.
214
- var3: Extra test data. Access with "self.var3" in tests.
215
- variables: DICT (Extra test data. Access with "self.variables")
216
- account: Set account. Access with "self.account" in tests.
217
- environment: Set the test env. Access with "self.env" in tests.
218
- headed: Run tests in headed/GUI mode on Linux, where not default.
219
- maximize: Start tests with the browser window maximized.
220
- disable_ws: Reverse of "enable_ws". (None and False are different)
221
- disable_beforeunload: Disable the "beforeunload" event on Chromium.
222
- settings_file: A file for overriding default SeleniumBase settings.
223
- uc: Shortcut / Duplicate of "undetectable".
224
- undetected: Shortcut / Duplicate of "undetectable".
225
- uc_cdp: Shortcut / Duplicate of "uc_cdp_events".
226
- uc_sub: Shortcut / Duplicate of "uc_subprocess".
227
- log_cdp: Shortcut / Duplicate of "log_cdp_events".
228
- ad_block: Shortcut / Duplicate of "ad_block_on".
229
- server: Shortcut / Duplicate of "servername".
230
- guest: Shortcut / Duplicate of "guest_mode".
231
- wire: Shortcut / Duplicate of "use_wire".
232
- pls: Shortcut / Duplicate of "page_load_strategy".
233
- sjw: Shortcut / Duplicate of "skip_js_waits".
234
- wfa: Shortcut / Duplicate of "wait_for_angularjs".
235
- save_screenshot: Save a screenshot at the end of each test.
236
- no_screenshot: No screenshots saved unless tests directly ask it.
237
- page_load_strategy: Set Chrome PLS to "normal", "eager", or "none".
238
- timeout_multiplier: Multiplies the default timeout values.
239
- js_checking_on: Check for JavaScript errors after page loads.
240
- slow: Slow down the automation. Faster than using Demo Mode.
241
- demo: Slow down and visually see test actions as they occur.
242
- demo_sleep: SECONDS (Set wait time after Slow & Demo Mode actions.)
243
- message_duration: SECONDS (The time length for Messenger alerts.)
244
- highlights: Number of highlight animations for Demo Mode actions.
245
- interval: SECONDS (Autoplay interval for SB Slides & Tour steps.)
246
- time_limit: SECONDS (Safely fail tests that exceed the time limit.)
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)
247
249
  """
248
250
  import os
249
251
  import sys
@@ -401,6 +403,13 @@ def SB(
401
403
  headless = True
402
404
  else:
403
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
404
413
  if headless2 is None:
405
414
  if "--headless2" in sys_argv:
406
415
  headless2 = True
@@ -672,6 +681,7 @@ def SB(
672
681
  recorder_ext = True
673
682
  if recorder_mode and headless:
674
683
  headless = False
684
+ headless1 = False
675
685
  headless2 = True
676
686
  sb_config.proxy_driver = False
677
687
  if "--proxy-driver" in sys_argv or "--proxy_driver" in sys_argv:
@@ -801,6 +811,7 @@ def SB(
801
811
  save_screenshot = False # "no_screenshot" has priority
802
812
  if browser == "safari" and headless:
803
813
  headless = False # Safari doesn't support headless mode
814
+ headless1 = False
804
815
  if js_checking_on is None:
805
816
  if "--check-js" in sys_argv:
806
817
  js_checking_on = True
@@ -921,6 +932,7 @@ def SB(
921
932
  sb_config.is_nosetest = False
922
933
  sb_config.is_context_manager = True
923
934
  sb_config.headless = headless
935
+ sb_config.headless1 = headless1
924
936
  sb_config.headless2 = headless2
925
937
  sb_config.headed = headed
926
938
  sb_config.xvfb = xvfb
@@ -1026,6 +1038,7 @@ def SB(
1026
1038
  sb.is_nosetest = False
1027
1039
  sb.is_context_manager = sb_config.is_context_manager
1028
1040
  sb.headless = sb_config.headless
1041
+ sb.headless1 = sb_config.headless1
1029
1042
  sb.headless2 = sb_config.headless2
1030
1043
  sb.headed = sb_config.headed
1031
1044
  sb.xvfb = sb_config.xvfb
@@ -43,8 +43,9 @@ class SeleniumBrowser(Plugin):
43
43
  --sjw (Skip JS Waits for readyState to be "complete" or Angular to load.)
44
44
  --wfa (Wait for AngularJS to be done loading after specific web actions.)
45
45
  --pls=PLS (Set pageLoadStrategy on Chrome: "normal", "eager", or "none".)
46
- --headless (Run tests in headless mode. The default arg on Linux OS.)
47
- --headless2 (Use the new headless mode, which supports extensions.)
46
+ --headless (The default headless mode. Linux uses this mode by default.)
47
+ --headless1 (Use Chrome's old headless mode. Fast, but has limitations.)
48
+ --headless2 (Use Chrome's new headless mode, which supports extensions.)
48
49
  --headed (Run tests in headed/GUI mode on Linux OS, where not default.)
49
50
  --xvfb (Run tests using the Xvfb virtual display server on Linux OS.)
50
51
  --xvfb-metrics=STRING (Set Xvfb display size on Linux: "Width,Height".)
@@ -437,6 +438,15 @@ class SeleniumBrowser(Plugin):
437
438
  UNLESS using a virtual display with Xvfb.
438
439
  Default: False on Mac/Windows. True on Linux.""",
439
440
  )
441
+ parser.addoption(
442
+ "--headless1",
443
+ action="store_true",
444
+ dest="headless1",
445
+ default=False,
446
+ help="""This option activates the old headless mode,
447
+ which is faster, but has limitations.
448
+ (May be phased out by Chrome in the future.)""",
449
+ )
440
450
  parser.addoption(
441
451
  "--headless2",
442
452
  action="store_true",
@@ -1009,6 +1019,7 @@ class SeleniumBrowser(Plugin):
1009
1019
  browser = self.options.browser
1010
1020
  test.test.browser = browser
1011
1021
  test.test.headless = None
1022
+ test.test.headless1 = None
1012
1023
  test.test.headless2 = None
1013
1024
  # As a shortcut, you can use "--edge" instead of "--browser=edge", etc,
1014
1025
  # but you can only specify one default browser. (Default: chrome)
@@ -1147,9 +1158,13 @@ class SeleniumBrowser(Plugin):
1147
1158
  test.test.cap_file = self.options.cap_file
1148
1159
  test.test.cap_string = self.options.cap_string
1149
1160
  test.test.headless = self.options.headless
1161
+ test.test.headless1 = self.options.headless1
1162
+ if test.test.headless1:
1163
+ test.test.headless = True
1150
1164
  test.test.headless2 = self.options.headless2
1151
1165
  if test.test.headless and test.test.browser == "safari":
1152
1166
  test.test.headless = False # Safari doesn't use headless
1167
+ test.test.headless1 = False
1153
1168
  if test.test.headless2 and test.test.browser == "firefox":
1154
1169
  test.test.headless2 = False # Only for Chromium browsers
1155
1170
  test.test.headless = True # Firefox has regular headless
@@ -1294,8 +1309,10 @@ class SeleniumBrowser(Plugin):
1294
1309
  # Recorder Mode can still optimize scripts in --headless2 mode.
1295
1310
  if self.options.recorder_mode and self.options.headless:
1296
1311
  self.options.headless = False
1312
+ self.options.headless1 = False
1297
1313
  self.options.headless2 = True
1298
1314
  test.test.headless = False
1315
+ test.test.headless1 = False
1299
1316
  test.test.headless2 = True
1300
1317
  if not self.options.headless and not self.options.headless2:
1301
1318
  self.options.headed = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seleniumbase
3
- Version: 4.31.0
3
+ Version: 4.31.1
4
4
  Summary: A complete web automation framework for end-to-end testing.
5
5
  Home-page: https://github.com/seleniumbase/SeleniumBase
6
6
  Author: Michael Mintz
@@ -821,8 +821,9 @@ pytest test_coffee_cart.py --trace
821
821
  --sjw # (Skip JS Waits for readyState to be "complete" or Angular to load.)
822
822
  --wfa # (Wait for AngularJS to be done loading after specific web actions.)
823
823
  --pls=PLS # (Set pageLoadStrategy on Chrome: "normal", "eager", or "none".)
824
- --headless # (Run tests in headless mode. The default arg on Linux OS.)
825
- --headless2 # (Use the new headless mode, which supports extensions.)
824
+ --headless # (The default headless mode. Linux uses this mode by default.)
825
+ --headless1 # (Use Chrome's old headless mode. Fast, but has limitations.)
826
+ --headless2 # (Use Chrome's new headless mode, which supports extensions.)
826
827
  --headed # (Run tests in headed/GUI mode on Linux OS, where not default.)
827
828
  --xvfb # (Run tests using the Xvfb virtual display server on Linux OS.)
828
829
  --xvfb-metrics=STRING # (Set Xvfb display size on Linux: "Width,Height".)
@@ -3,10 +3,10 @@ sbase/__main__.py,sha256=G0bVB1-DM4PGwQ1KyOupaWCs4ePbChZNNWuX2htim5U,647
3
3
  sbase/steps.py,sha256=bKT_u5bJkKzYWEuAXi9NVVRYYxQRCM1_YJUrNFFRVPY,42865
4
4
  seleniumbase/__init__.py,sha256=pXetYtgSNEM2KRcZedpSSqE52Kr3spkOD6DjZO1Wsu4,2236
5
5
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
6
- seleniumbase/__version__.py,sha256=pqpXGIksdOnytIY3oWL5AUa-pfVc42jPohuIpus0T9U,46
6
+ seleniumbase/__version__.py,sha256=ZPjiQBuD0UdNKlKtSQnk1zCFPlVf6h5pTkS742IHrJc,46
7
7
  seleniumbase/behave/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  seleniumbase/behave/behave_helper.py,sha256=elkl8P9eLulRAioLstE9baYNM9N_PHBmAOcajX-pH_Y,24198
9
- seleniumbase/behave/behave_sb.py,sha256=1-SDxXx9EQSMztCUda3KDO5rfwmfWthKmwWFiFyiTow,58844
9
+ seleniumbase/behave/behave_sb.py,sha256=B8v7bR4Kie0RRYph9i43OT3PHhHent_hhB6uQUzVZ0I,59189
10
10
  seleniumbase/behave/steps.py,sha256=8-N-NB2tnDsxaP4LSg-uSBgbwZYMS6ZEL1oggO1PCoU,390
11
11
  seleniumbase/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  seleniumbase/common/decorators.py,sha256=LJnAgg0RG3kDOFb8tpyq1zjmpv9ks6Tjg8GwgIn1YuY,7633
@@ -19,9 +19,9 @@ seleniumbase/config/ad_block_list.py,sha256=qCQvbpONdSXk6q5tMwLuOswGYE1Syd8cy5TM
19
19
  seleniumbase/config/proxy_list.py,sha256=tSdk82_6pPqClotHMl3YOTlxi9IIEppHmCoQDkZXLqw,1123
20
20
  seleniumbase/config/settings.py,sha256=cAMmoFBQ6g8GCJIsRsSwGsP1_fJxhADxjHq30lFB18g,7815
21
21
  seleniumbase/console_scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- seleniumbase/console_scripts/logo_helper.py,sha256=F8pcANlWY6pdcMwHUdjjpjAD9i8XD0R5J-28eSh7QMM,1907
22
+ seleniumbase/console_scripts/logo_helper.py,sha256=GoCH_tTSPd-oGAacgFPpKw0MnJ3_i9eacxXdJMwNoH8,3136
23
23
  seleniumbase/console_scripts/rich_helper.py,sha256=U_zvXpalxVV8rtg8c8EnNNmnh45tii3AV5ZV3O3KbGA,2234
24
- seleniumbase/console_scripts/run.py,sha256=H7sWc5Bni_RTk4rWqiLZ6b1lhHnKjfVZjy1xYehl2YE,59327
24
+ seleniumbase/console_scripts/run.py,sha256=bc4yk6NgMVVVD2ca6XsmL_4hmpOz6AS4MrTAV1gTgCk,59354
25
25
  seleniumbase/console_scripts/sb_behave_gui.py,sha256=Sm8OVgq1SJ6F-8Dl-xflglEmOpNJn4C_-ZPuHRiZvTM,15375
26
26
  seleniumbase/console_scripts/sb_caseplans.py,sha256=77Ocuok2v36x7i1Qmp6sGSdDf3H5y6gPB5QtxHHcjgo,18373
27
27
  seleniumbase/console_scripts/sb_commander.py,sha256=SNBOApj4JV_jtdoV7WPFVSWhFqLkPWOpFB8KPKYufGU,13557
@@ -36,7 +36,7 @@ seleniumbase/console_scripts/sb_print.py,sha256=yo641b_OdSE0GUauOyxk-QrNeIjYzbRY
36
36
  seleniumbase/console_scripts/sb_recorder.py,sha256=QazacANTQgoc76abAfFUV0d4ja1o-bbsoX9sTPZr_eg,11134
37
37
  seleniumbase/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  seleniumbase/core/application_manager.py,sha256=e_0sjtI8cjY5BNyZj1QBR0j6_oCScxGmSXYEpcYwuZE,576
39
- seleniumbase/core/browser_launcher.py,sha256=r-95DrVNk5TEnX0wKAIzR-aau6XskVNujF3OMWYisk8,203405
39
+ seleniumbase/core/browser_launcher.py,sha256=udC8RtY7E6rcw5m5zkrpQZLtyz5yXFiwL7hmub8Iw5g,204822
40
40
  seleniumbase/core/capabilities_parser.py,sha256=meIS2uHapTCq2ldfNAToC7r0cKmZDRXuYNKExM1GHDY,6038
41
41
  seleniumbase/core/colored_traceback.py,sha256=DrRWfg7XEnKcgY59Xj7Jdk09H-XqHYBSUpB-DiZt6iY,2020
42
42
  seleniumbase/core/create_db_tables.sql,sha256=VWPtrdiW_HQ6yETHjqTu-VIrTwvd8I8o1NfBeaVSHpU,972
@@ -50,7 +50,7 @@ seleniumbase/core/proxy_helper.py,sha256=cXhu8ErK9Vjdm82RMaQj7hEq_yUWizSp6LyiD50
50
50
  seleniumbase/core/recorder_helper.py,sha256=fNGjbapXmEsht54x1o6Igk198QdnPxDDnjUOzQxNhNQ,25055
51
51
  seleniumbase/core/report_helper.py,sha256=AIl6Qava2yW1uSzbLpJBlPlYDz0KE-rVhogh8hsGWBo,12201
52
52
  seleniumbase/core/s3_manager.py,sha256=bkeI8I4y19ebWuQG1oEZV5qJbotC6eN8vin31OCNWJk,3521
53
- seleniumbase/core/sb_driver.py,sha256=zIC0kvVmZM6ZNeYd4Hvd6iuh95rxsuipIXE6P5UacIY,9745
53
+ seleniumbase/core/sb_driver.py,sha256=_oC9esOgxhKXssMEzS-3gfNuqevJSr8eZ39ClL4ZuSk,10037
54
54
  seleniumbase/core/session_helper.py,sha256=s9zD3PVZEWVzG2h81cCUskbNWLfdjC_LwwQjKptHCak,558
55
55
  seleniumbase/core/settings_parser.py,sha256=KokVXpCiGZhJ-D4Bo-hizPz5r-iefzWoiTANu9zNaq4,7504
56
56
  seleniumbase/core/style_sheet.py,sha256=tPpJ1xl6Kuw425Z-3Y0OgVRLGXk_ciBDREZjXk_NuPE,11395
@@ -64,13 +64,13 @@ seleniumbase/extensions/disable_csp.zip,sha256=YMifIIgEBiLrEFrS1sfW4Exh4br1V4oK1
64
64
  seleniumbase/extensions/recorder.zip,sha256=OOyzF-Ize2cSRu1CqhzSAq5vusI9hqLLd2OIApUHesI,11918
65
65
  seleniumbase/extensions/sbase_ext.zip,sha256=3s1N8zrVaMz8RQEOIoBzC3KDjtmHwVZRvVsX25Odr_s,8175
66
66
  seleniumbase/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
- seleniumbase/fixtures/base_case.py,sha256=fhr7e79Ofovb6Ib-iTaDeEsWB-XtBitu85a0gkpfz58,701811
67
+ seleniumbase/fixtures/base_case.py,sha256=Rz0gC0gAse85jcV4iiY_fxLaoq6-QJTcUAVNk7DVOhM,702330
68
68
  seleniumbase/fixtures/constants.py,sha256=TapuGLdERtvZPGMblVXkNGybr8tj8FMtN3sbJ3ygyoc,13569
69
69
  seleniumbase/fixtures/css_to_xpath.py,sha256=9ouDB1xl4MJ2os6JOgTIAyHKOQfuxtxvXC3O5hSnEKA,1954
70
70
  seleniumbase/fixtures/errors.py,sha256=KyxuEVx_e3MPhVrJfNIa_3ltMpbCFxfy_jxK8RFNTns,555
71
71
  seleniumbase/fixtures/js_utils.py,sha256=cYFRazc6iO2tTB5kf3_mW3czMQ8mJ5OSHldx7n31E8E,50940
72
72
  seleniumbase/fixtures/page_actions.py,sha256=5xYWeTDLs9i1yOs5iWDk17CLoiUU5kRLHlmKRUJ7TcQ,63030
73
- seleniumbase/fixtures/page_utils.py,sha256=NY1B6b_C6cwxLkKM1SHXfadDEcTH80fXGAatfAyiLSc,11986
73
+ seleniumbase/fixtures/page_utils.py,sha256=5m7iXpikLs80TJoRO6_gEfXE1AKeQgcH1aFbR8o1C9A,12034
74
74
  seleniumbase/fixtures/shared_utils.py,sha256=Fc78v0OxfLPOPqeT8ExsdkTgXHlmpxvJeLbLyDnu1dI,5748
75
75
  seleniumbase/fixtures/unittest_helper.py,sha256=sfZ92rZeBAn_sF_yQ3I6_I7h3lyU5-cV_UMegBNoEm8,1294
76
76
  seleniumbase/fixtures/words.py,sha256=FOA4mAYvl3EPVpBTvgvK6YwCL8BdlRCmed685kEe7Vg,7827
@@ -85,13 +85,13 @@ seleniumbase/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
85
85
  seleniumbase/plugins/base_plugin.py,sha256=FemdftNhOaTfQIw5bWcJQPPPGQ3P0_sMEI_YYDuzZgU,14972
86
86
  seleniumbase/plugins/basic_test_info.py,sha256=8ov6n417gPbqqvrlT4zrch7l2XcRt-GF2ny6rR9AMWk,2108
87
87
  seleniumbase/plugins/db_reporting_plugin.py,sha256=En09qUCoojrk9-vbcnsoHdSELoGmag2GDIyu3jTiJas,7331
88
- seleniumbase/plugins/driver_manager.py,sha256=LOt9sD06KD4ghMBgSDkIscBmbnWoiHgJmkcdFXsdWxA,32647
88
+ seleniumbase/plugins/driver_manager.py,sha256=Rs2UE1yv5Npcdev7F4nwhQoTD25MpNYDINe7H0luyfY,33361
89
89
  seleniumbase/plugins/page_source.py,sha256=loTnXxOj4kxEukuTZEiGyvKBhY3KDVDMnNlHHheTBDE,1889
90
- seleniumbase/plugins/pytest_plugin.py,sha256=U-FVZkR2V3WGv_27Hvqk7Atse0HA49hT9wfr7-Ipqu8,96521
90
+ seleniumbase/plugins/pytest_plugin.py,sha256=1NTzVJOd6zMvq16lPQHglfdguU3C0tj94FY6DZNZUBU,97106
91
91
  seleniumbase/plugins/s3_logging_plugin.py,sha256=WDfertQgGOW_SRJpFMaekYD6vBVW9VO62POtXXy2HCM,2319
92
- seleniumbase/plugins/sb_manager.py,sha256=nvp37M_P1ky1Wxl05PaRdFefnScWLr9njXnYYaN01LI,51898
92
+ seleniumbase/plugins/sb_manager.py,sha256=g5woe7oYYe4Dav50nuIN5RClynrvZ1H8uhxLSyxl9Q4,53016
93
93
  seleniumbase/plugins/screen_shots.py,sha256=1hrXw-hzuZ1BR6Yh7AyWX2ABnvnP73-RCbwdz958gj4,1127
94
- seleniumbase/plugins/selenium_plugin.py,sha256=Ko5QBHVbNa8NOPlibRRgshdl5S0YOKo576pCeFW_qAw,57871
94
+ seleniumbase/plugins/selenium_plugin.py,sha256=yDk-CuyuRiMw3eZlUOWh15d5WtsTex_dhhdMxKUUexg,58583
95
95
  seleniumbase/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
96
  seleniumbase/translate/__init__.py,sha256=N2i5XntTwJZmwr9-qvdX5gC6Rdm5-ClIbnQ8yyPn4Oo,459
97
97
  seleniumbase/translate/chinese.py,sha256=0QhK2eadtsdN4KCvwki1J7jBCe8I4xxWbKzteJKJozY,24698
@@ -126,9 +126,9 @@ seleniumbase/utilities/selenium_grid/start-grid-hub.bat,sha256=Ftq-GrAKRYH2ssDPr
126
126
  seleniumbase/utilities/selenium_grid/start-grid-hub.sh,sha256=KADv0RUHONLL2_I443QFK8PryBpDmKn5Gy0s4o0vDSM,106
127
127
  seleniumbase/utilities/selenium_ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
128
  seleniumbase/utilities/selenium_ide/convert_ide.py,sha256=pZFnqEJQEKZPyNFjkLD29s2HPQgCrWW9XJWpCPhWOoM,31691
129
- seleniumbase-4.31.0.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
130
- seleniumbase-4.31.0.dist-info/METADATA,sha256=H3_T9Hh20tgyREt7LmP34MsLHYsS-BYgM_knTkVgKho,85160
131
- seleniumbase-4.31.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
132
- seleniumbase-4.31.0.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
133
- seleniumbase-4.31.0.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
134
- seleniumbase-4.31.0.dist-info/RECORD,,
129
+ seleniumbase-4.31.1.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
130
+ seleniumbase-4.31.1.dist-info/METADATA,sha256=MShVjw08x3Ga43QfWzUgOWal5fuCx_hMdQuK_rsYEm4,85244
131
+ seleniumbase-4.31.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
132
+ seleniumbase-4.31.1.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
133
+ seleniumbase-4.31.1.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
134
+ seleniumbase-4.31.1.dist-info/RECORD,,