seleniumbase 4.31.0__py3-none-any.whl → 4.31.2__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.
@@ -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".
@@ -80,7 +81,8 @@ def Driver(
80
81
  cap_file=None, # The desired capabilities to use with a Selenium Grid.
81
82
  cap_string=None, # The desired capabilities to use with a Selenium Grid.
82
83
  recorder_ext=None, # Enables the SeleniumBase Recorder Chromium extension.
83
- disable_js=None, # Disable JavaScript on websites. Pages might break!
84
+ disable_cookies=None, # Disable Cookies on websites. (Pages might break!)
85
+ disable_js=None, # Disable JavaScript on websites. (Pages might break!)
84
86
  disable_csp=None, # Disable the Content Security Policy of websites.
85
87
  enable_ws=None, # Enable Web Security on Chromium-based browsers.
86
88
  disable_ws=None, # Reverse of "enable_ws". (None and False are different)
@@ -154,74 +156,76 @@ def Driver(
154
156
 
155
157
  Optional Parameters:
156
158
  --------------------
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".
159
+ browser (str): Choose from "chrome", "edge", "firefox", or "safari".
160
+ headless (bool): Use the default headless mode for Chromium and Firefox.
161
+ headless1 (bool): Use Chromium's old headless mode. (Fast, but limited)
162
+ headless2 (bool): Use Chromium's new headless mode. (Has more features)
163
+ headed (bool): Run tests in headed/GUI mode on Linux, where not default.
164
+ locale_code (str): Set the Language Locale Code for the web browser.
165
+ protocol (str): The Selenium Grid protocol: "http" or "https".
166
+ servername (str): The Selenium Grid server/IP used for tests.
167
+ port (int): The Selenium Grid port used by the test server.
168
+ proxy (str): Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT".
169
+ proxy_bypass_list (str): Skip proxy when using the listed domains.
170
+ proxy_pac_url (str): Use PAC file. (Format: URL or USERNAME:PASSWORD@URL)
171
+ multi_proxy (bool): Allow multiple proxies with auth when multi-threaded.
172
+ agent (str): Modify the web browser's User-Agent string.
173
+ cap_file (str): The desired capabilities to use with a Selenium Grid.
174
+ cap_string (str): The desired capabilities to use with a Selenium Grid.
175
+ recorder_ext (bool): Enables the SeleniumBase Recorder Chromium extension.
176
+ disable_cookies (bool): Disable Cookies on websites. (Pages might break!)
177
+ disable_js (bool): Disable JavaScript on websites. (Pages might break!)
178
+ disable_csp (bool): Disable the Content Security Policy of websites.
179
+ enable_ws (bool): Enable Web Security on Chromium-based browsers.
180
+ disable_ws (bool): Reverse of "enable_ws". (None and False are different)
181
+ enable_sync (bool): Enable "Chrome Sync" on websites.
182
+ use_auto_ext (bool): Use Chrome's automation extension.
183
+ undetectable (bool): Use undetected-chromedriver to evade bot-detection.
184
+ uc_cdp_events (bool): Capture CDP events in undetected-chromedriver mode.
185
+ uc_subprocess (bool): Use undetected-chromedriver as a subprocess.
186
+ log_cdp_events (bool): Capture {"performance": "ALL", "browser": "ALL"}
187
+ no_sandbox (bool): (DEPRECATED) - "--no-sandbox" is always used now.
188
+ disable_gpu (bool): (DEPRECATED) - GPU is disabled if not "swiftshader".
189
+ incognito (bool): Enable Chromium's Incognito mode.
190
+ guest_mode (bool): Enable Chromium's Guest mode.
191
+ dark_mode (bool): Enable Chromium's Dark mode.
192
+ devtools (bool): Open Chromium's DevTools when the browser opens.
193
+ remote_debug (bool): Enable Chrome's Debugger on "http://localhost:9222".
194
+ enable_3d_apis (bool): Enable WebGL and 3D APIs.
195
+ swiftshader (bool): Chrome: --use-gl=angle / --use-angle=swiftshader-webgl
196
+ ad_block_on (bool): Block some types of display ads from loading.
197
+ host_resolver_rules (str): Set host-resolver-rules, comma-separated.
198
+ block_images (bool): Block images from loading during tests.
199
+ do_not_track (bool): Tell websites that you don't want to be tracked.
200
+ chromium_arg (str): "ARG=N,ARG2" (Set Chromium args, ","-separated.)
201
+ firefox_arg (str): "ARG=N,ARG2" (Set Firefox args, comma-separated.)
202
+ firefox_pref (str): SET (Set Firefox PREFERENCE:VALUE set, ","-separated)
203
+ user_data_dir (str): Set the Chrome user data directory to use.
204
+ extension_zip (str): Load a Chrome Extension .zip|.crx, comma-separated.
205
+ extension_dir (str): Load a Chrome Extension directory, comma-separated.
206
+ disable_features (str): "F1,F2" (Disable Chrome features, ","-separated.)
207
+ binary_location (str): Set path of the Chromium browser binary to use.
208
+ driver_version (str): Set the chromedriver or uc_driver version to use.
209
+ page_load_strategy (str): Set Chrome PLS to "normal", "eager", or "none".
210
+ use_wire (bool): Use selenium-wire's webdriver over selenium webdriver.
211
+ external_pdf (bool): Set Chrome "plugins.always_open_pdf_externally":True
212
+ window_position (x,y): Set the browser's starting window position: "X,Y"
213
+ window_size (w,h): Set the browser's starting window size: "Width,Height"
214
+ is_mobile (bool): Use the mobile device emulator while running tests.
215
+ mobile (bool): Shortcut / Duplicate of "is_mobile".
216
+ d_width (int): Set device width
217
+ d_height (int): Set device height
218
+ d_p_r (float): Set device pixel ratio
219
+ uc (bool): Shortcut / Duplicate of "undetectable".
220
+ undetected (bool): Shortcut / Duplicate of "undetectable".
221
+ uc_cdp (bool): Shortcut / Duplicate of "uc_cdp_events".
222
+ uc_sub (bool): Shortcut / Duplicate of "uc_subprocess".
223
+ log_cdp (bool): Shortcut / Duplicate of "log_cdp_events".
224
+ ad_block (bool): Shortcut / Duplicate of "ad_block_on".
225
+ server (str): Shortcut / Duplicate of "servername".
226
+ guest (bool): Shortcut / Duplicate of "guest_mode".
227
+ wire (bool): Shortcut / Duplicate of "use_wire".
228
+ pls (str): Shortcut / Duplicate of "page_load_strategy".
225
229
  """
226
230
  from seleniumbase import config as sb_config
227
231
  from seleniumbase.config import settings
@@ -336,6 +340,13 @@ def Driver(
336
340
  headless = True
337
341
  else:
338
342
  headless = False
343
+ if headless1 is None:
344
+ if "--headless1" in sys_argv:
345
+ headless1 = True
346
+ else:
347
+ headless1 = False
348
+ if headless1:
349
+ headless = True
339
350
  if headless2 is None:
340
351
  if "--headless2" in sys_argv:
341
352
  headless2 = True
@@ -601,6 +612,7 @@ def Driver(
601
612
  headless = True
602
613
  if recorder_mode and headless:
603
614
  headless = False
615
+ headless1 = False
604
616
  headless2 = True
605
617
  if headless2 and browser == "firefox":
606
618
  headless2 = False # Only for Chromium browsers
@@ -636,6 +648,11 @@ def Driver(
636
648
  use_auto_ext = True
637
649
  else:
638
650
  use_auto_ext = False
651
+ if disable_cookies is None:
652
+ if "--disable-cookies" in sys_argv:
653
+ disable_cookies = True
654
+ else:
655
+ disable_cookies = False
639
656
  if disable_js is None:
640
657
  if "--disable-js" in sys_argv:
641
658
  disable_js = True
@@ -762,6 +779,7 @@ def Driver(
762
779
  cap_file=cap_file,
763
780
  cap_string=cap_string,
764
781
  recorder_ext=recorder_ext,
782
+ disable_cookies=disable_cookies,
765
783
  disable_js=disable_js,
766
784
  disable_csp=disable_csp,
767
785
  enable_ws=enable_ws,
@@ -773,6 +791,7 @@ def Driver(
773
791
  log_cdp_events=log_cdp_events,
774
792
  no_sandbox=no_sandbox,
775
793
  disable_gpu=disable_gpu,
794
+ headless1=headless1,
776
795
  headless2=headless2,
777
796
  incognito=incognito,
778
797
  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".)
@@ -89,6 +90,7 @@ def pytest_addoption(parser):
89
90
  --rec-behave (Same as Recorder Mode, but also generates behave-gherkin.)
90
91
  --rec-sleep (If the Recorder is enabled, also records self.sleep calls.)
91
92
  --rec-print (If the Recorder is enabled, prints output after tests end.)
93
+ --disable-cookies (Disable Cookies on websites. Pages might break!)
92
94
  --disable-js (Disable JavaScript on websites. Pages might break!)
93
95
  --disable-csp (Disable the Content Security Policy of websites.)
94
96
  --disable-ws (Disable Web Security on Chromium-based browsers.)
@@ -700,6 +702,15 @@ def pytest_addoption(parser):
700
702
  UNLESS using a virtual display with Xvfb.
701
703
  Default: False on Mac/Windows. True on Linux.""",
702
704
  )
705
+ parser.addoption(
706
+ "--headless1",
707
+ action="store_true",
708
+ dest="headless1",
709
+ default=False,
710
+ help="""This option activates the old headless mode,
711
+ which is faster, but has limitations.
712
+ (May be phased out by Chrome in the future.)""",
713
+ )
703
714
  parser.addoption(
704
715
  "--headless2",
705
716
  action="store_true",
@@ -982,6 +993,15 @@ def pytest_addoption(parser):
982
993
  help="""The option to disable JavaScript on web pages.
983
994
  Warning: Most web pages will stop working!""",
984
995
  )
996
+ parser.addoption(
997
+ "--disable_cookies",
998
+ "--disable-cookies",
999
+ action="store_true",
1000
+ dest="disable_cookies",
1001
+ default=False,
1002
+ help="""The option to disable Cookies on web pages.
1003
+ Warning: Several pages may stop working!""",
1004
+ )
985
1005
  parser.addoption(
986
1006
  "--disable_csp",
987
1007
  "--disable-csp",
@@ -1533,6 +1553,9 @@ def pytest_configure(config):
1533
1553
  sb_config.mobile_emulator = config.getoption("mobile_emulator")
1534
1554
  sb_config.device_metrics = config.getoption("device_metrics")
1535
1555
  sb_config.headless = config.getoption("headless")
1556
+ sb_config.headless1 = config.getoption("headless1")
1557
+ if sb_config.headless1:
1558
+ sb_config.headless = True
1536
1559
  sb_config.headless2 = config.getoption("headless2")
1537
1560
  if sb_config.headless2 and sb_config.browser == "firefox":
1538
1561
  sb_config.headless2 = False # Only for Chromium browsers
@@ -1615,6 +1638,7 @@ def pytest_configure(config):
1615
1638
  elif sb_config.record_sleep and not sb_config.recorder_mode:
1616
1639
  sb_config.recorder_mode = True
1617
1640
  sb_config.recorder_ext = True
1641
+ sb_config.disable_cookies = config.getoption("disable_cookies")
1618
1642
  sb_config.disable_js = config.getoption("disable_js")
1619
1643
  sb_config.disable_csp = config.getoption("disable_csp")
1620
1644
  sb_config.disable_ws = config.getoption("disable_ws")
@@ -1759,6 +1783,7 @@ def pytest_configure(config):
1759
1783
  # Recorder Mode can still optimize scripts in --headless2 mode.
1760
1784
  if sb_config.recorder_mode and sb_config.headless:
1761
1785
  sb_config.headless = False
1786
+ sb_config.headless1 = False
1762
1787
  sb_config.headless2 = True
1763
1788
 
1764
1789
  if not sb_config.headless and not sb_config.headless2:
@@ -1779,6 +1804,7 @@ def pytest_configure(config):
1779
1804
 
1780
1805
  if sb_config.browser == "safari" and sb_config.headless:
1781
1806
  sb_config.headless = False # Safari doesn't support headless mode
1807
+ sb_config.headless1 = False
1782
1808
 
1783
1809
  if sb_config.dash_title:
1784
1810
  constants.Dashboard.TITLE = sb_config.dash_title.replace("_", " ")