seleniumbase 4.43.2__py3-none-any.whl → 4.43.3__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.
@@ -1,2 +1,2 @@
1
1
  # seleniumbase package
2
- __version__ = "4.43.2"
2
+ __version__ = "4.43.3"
@@ -28,6 +28,10 @@ from seleniumbase import decorators
28
28
  from seleniumbase import drivers # webdriver storage folder for SeleniumBase
29
29
  from seleniumbase.drivers import cft_drivers # chrome-for-testing
30
30
  from seleniumbase.drivers import chs_drivers # chrome-headless-shell
31
+ from seleniumbase.drivers import opera_drivers # still uses chromedriver
32
+ from seleniumbase.drivers import brave_drivers # still uses chromedriver
33
+ from seleniumbase.drivers import comet_drivers # still uses chromedriver
34
+ from seleniumbase.drivers import atlas_drivers # still uses chromedriver
31
35
  from seleniumbase import extensions # browser extensions storage folder
32
36
  from seleniumbase.config import settings
33
37
  from seleniumbase.core import detect_b_ver
@@ -44,6 +48,10 @@ urllib3.disable_warnings()
44
48
  DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
45
49
  DRIVER_DIR_CFT = os.path.dirname(os.path.realpath(cft_drivers.__file__))
46
50
  DRIVER_DIR_CHS = os.path.dirname(os.path.realpath(chs_drivers.__file__))
51
+ DRIVER_DIR_OPERA = os.path.dirname(os.path.realpath(opera_drivers.__file__))
52
+ DRIVER_DIR_BRAVE = os.path.dirname(os.path.realpath(brave_drivers.__file__))
53
+ DRIVER_DIR_COMET = os.path.dirname(os.path.realpath(comet_drivers.__file__))
54
+ DRIVER_DIR_ATLAS = os.path.dirname(os.path.realpath(atlas_drivers.__file__))
47
55
  # Make sure that the SeleniumBase DRIVER_DIR is at the top of the System PATH
48
56
  # (Changes to the System PATH with os.environ only last during the test run)
49
57
  if not os.environ["PATH"].startswith(DRIVER_DIR):
@@ -1218,8 +1226,8 @@ def uc_gui_click_x_y(driver, x, y, timeframe=0.25):
1218
1226
  driver.cdp.minimize()
1219
1227
  driver.cdp.set_window_rect(win_x, win_y, width, height)
1220
1228
  if IS_WINDOWS:
1221
- x = x * width_ratio
1222
- y = y * width_ratio
1229
+ x = x * (width_ratio + 0.03)
1230
+ y = y * (width_ratio - 0.03)
1223
1231
  _uc_gui_click_x_y(driver, x, y, timeframe=timeframe, uc_lock=False)
1224
1232
  return
1225
1233
  with suppress(Exception):
@@ -1260,7 +1268,7 @@ def _uc_gui_click_captcha(
1260
1268
  ctype=None,
1261
1269
  ):
1262
1270
  cdp_mode_on_at_start = __is_cdp_swap_needed(driver)
1263
- if cdp_mode_on_at_start and (not ctype or ctype == "cf_t"):
1271
+ if cdp_mode_on_at_start:
1264
1272
  return driver.cdp.gui_click_captcha()
1265
1273
  _on_a_captcha_page = None
1266
1274
  if ctype == "cf_t":
@@ -1952,6 +1960,15 @@ def get_valid_binary_names_for_browser(browser):
1952
1960
  raise Exception("Invalid combination for OS browser binaries!")
1953
1961
 
1954
1962
 
1963
+ def _special_binary_exists(location, name):
1964
+ filename = str(location).split("/")[-1].split("\\")[-1]
1965
+ return (
1966
+ location
1967
+ and str(name).lower() in filename.lower()
1968
+ and os.path.exists(location)
1969
+ )
1970
+
1971
+
1955
1972
  def _repair_chromedriver(chrome_options, headless_options, mcv=None):
1956
1973
  if mcv:
1957
1974
  subprocess.check_call(
@@ -2960,6 +2977,14 @@ def get_driver(
2960
2977
  and sb_config.binary_location == "chs"
2961
2978
  ):
2962
2979
  driver_dir = DRIVER_DIR_CHS
2980
+ if _special_binary_exists(binary_location, "opera"):
2981
+ driver_dir = DRIVER_DIR_OPERA
2982
+ if _special_binary_exists(binary_location, "brave"):
2983
+ driver_dir = DRIVER_DIR_BRAVE
2984
+ if _special_binary_exists(binary_location, "comet"):
2985
+ driver_dir = DRIVER_DIR_COMET
2986
+ if _special_binary_exists(binary_location, "atlas"):
2987
+ driver_dir = DRIVER_DIR_ATLAS
2963
2988
  if (
2964
2989
  hasattr(sb_config, "settings")
2965
2990
  and hasattr(sb_config.settings, "NEW_DRIVER_DIR")
@@ -3919,6 +3944,18 @@ def get_local_driver(
3919
3944
  ):
3920
3945
  special_chrome = True
3921
3946
  driver_dir = DRIVER_DIR_CHS
3947
+ if _special_binary_exists(binary_location, "opera"):
3948
+ special_chrome = True
3949
+ driver_dir = DRIVER_DIR_OPERA
3950
+ if _special_binary_exists(binary_location, "brave"):
3951
+ special_chrome = True
3952
+ driver_dir = DRIVER_DIR_BRAVE
3953
+ if _special_binary_exists(binary_location, "comet"):
3954
+ special_chrome = True
3955
+ driver_dir = DRIVER_DIR_COMET
3956
+ if _special_binary_exists(binary_location, "atlas"):
3957
+ special_chrome = True
3958
+ driver_dir = DRIVER_DIR_ATLAS
3922
3959
  if (
3923
3960
  hasattr(sb_config, "settings")
3924
3961
  and hasattr(sb_config.settings, "NEW_DRIVER_DIR")
@@ -4756,6 +4793,27 @@ def get_local_driver(
4756
4793
  )
4757
4794
  return extend_driver(driver)
4758
4795
  elif browser_name == constants.Browser.GOOGLE_CHROME:
4796
+ set_chromium = None
4797
+ if _special_binary_exists(binary_location, "opera"):
4798
+ set_chromium = "opera"
4799
+ local_chromedriver = DRIVER_DIR_OPERA + "/chromedriver"
4800
+ if IS_WINDOWS:
4801
+ local_chromedriver = DRIVER_DIR_OPERA + "/chromedriver.exe"
4802
+ if _special_binary_exists(binary_location, "brave"):
4803
+ set_chromium = "brave"
4804
+ local_chromedriver = DRIVER_DIR_BRAVE + "/chromedriver"
4805
+ if IS_WINDOWS:
4806
+ local_chromedriver = DRIVER_DIR_BRAVE + "/chromedriver.exe"
4807
+ if _special_binary_exists(binary_location, "comet"):
4808
+ set_chromium = "comet"
4809
+ local_chromedriver = DRIVER_DIR_COMET + "/chromedriver"
4810
+ if IS_WINDOWS:
4811
+ local_chromedriver = DRIVER_DIR_COMET + "/chromedriver.exe"
4812
+ if _special_binary_exists(binary_location, "atlas"):
4813
+ set_chromium = "atlas"
4814
+ local_chromedriver = DRIVER_DIR_ATLAS + "/chromedriver"
4815
+ if IS_WINDOWS:
4816
+ local_chromedriver = DRIVER_DIR_ATLAS + "/chromedriver.exe"
4759
4817
  try:
4760
4818
  chrome_options = _set_chrome_options(
4761
4819
  browser_name,
@@ -4877,6 +4935,12 @@ def get_local_driver(
4877
4935
  major_chrome_version = None
4878
4936
  if major_chrome_version:
4879
4937
  use_version = major_chrome_version
4938
+ if (
4939
+ set_chromium == "opera"
4940
+ and use_version.isnumeric()
4941
+ and int(use_version) < 130
4942
+ ):
4943
+ use_version = "130" # Special case
4880
4944
  ch_driver_version = None
4881
4945
  path_chromedriver = chromedriver_on_path()
4882
4946
  if os.path.exists(local_chromedriver):
@@ -4894,7 +4958,7 @@ def get_local_driver(
4894
4958
  ch_driver_version = output
4895
4959
  if driver_version == "keep":
4896
4960
  driver_version = ch_driver_version
4897
- elif path_chromedriver:
4961
+ elif path_chromedriver and not set_chromium:
4898
4962
  try:
4899
4963
  make_driver_executable_if_not(path_chromedriver)
4900
4964
  except Exception as e:
@@ -282,7 +282,7 @@ def opera_on_windows_path(browser_type=None):
282
282
  "Opera/Application",
283
283
  ):
284
284
  try:
285
- candidates.append(os.sep.join((item, subitem, "launcher.exe")))
285
+ candidates.append(os.sep.join((item, subitem, "opera.exe")))
286
286
  except TypeError:
287
287
  pass
288
288
  for candidate in candidates:
@@ -1333,6 +1333,17 @@ class CDPMethods():
1333
1333
  x = window_rect["x"] + element_rect["x"]
1334
1334
  y = w_bottom_y - viewport_height + element_rect["y"]
1335
1335
  y_scroll_offset = window_rect["pageYOffset"]
1336
+ if (
1337
+ hasattr(sb_config, "_cdp_browser")
1338
+ and sb_config._cdp_browser == "opera"
1339
+ ):
1340
+ # Handle special case where Opera side panel shifts coordinates
1341
+ x_offset = window_rect["outerWidth"] - window_rect["innerWidth"]
1342
+ if x_offset > 56:
1343
+ x_offset = 56
1344
+ elif x_offset < 22:
1345
+ x_offset = 0
1346
+ x = x + x_offset
1336
1347
  y = y - y_scroll_offset
1337
1348
  x = x + window_rect["scrollX"]
1338
1349
  y = y + window_rect["scrollY"]
@@ -1674,11 +1685,6 @@ class CDPMethods():
1674
1685
  import pyautogui
1675
1686
  pyautogui = self.__get_configured_pyautogui(pyautogui)
1676
1687
  screen_width, screen_height = pyautogui.size()
1677
- if (
1678
- hasattr(sb_config, "_cdp_browser")
1679
- and sb_config._cdp_browser == "opera"
1680
- ):
1681
- x = x + 55
1682
1688
  if x < 0 or y < 0 or x > screen_width or y > screen_height:
1683
1689
  raise Exception(
1684
1690
  "PyAutoGUI cannot click on point (%s, %s)"
@@ -1731,8 +1737,8 @@ class CDPMethods():
1731
1737
  self.__add_light_pause()
1732
1738
  self.__set_window_rect(win_x, win_y, width, height)
1733
1739
  self.__add_light_pause()
1734
- x = x * width_ratio
1735
- y = y * width_ratio
1740
+ x = x * (width_ratio + 0.03)
1741
+ y = y * (width_ratio - 0.03)
1736
1742
  self.bring_active_window_to_front()
1737
1743
  self.__gui_click_x_y(x, y, timeframe=timeframe, uc_lock=False)
1738
1744
 
@@ -1760,8 +1766,43 @@ class CDPMethods():
1760
1766
  return True
1761
1767
  return False
1762
1768
 
1769
+ def _on_a_g_recaptcha_page(self):
1770
+ time.sleep(0.042)
1771
+ source = self.get_page_source()
1772
+ if not source or len(source) < 400:
1773
+ time.sleep(0.22)
1774
+ source = self.get_page_source()
1775
+ if (
1776
+ 'id="recaptcha-token"' in source
1777
+ or 'title="reCAPTCHA"' in source
1778
+ ):
1779
+ return True
1780
+ return False
1781
+
1782
+ def __gui_click_recaptcha(self):
1783
+ selector = None
1784
+ if self.is_element_visible('iframe[title="reCAPTCHA"]'):
1785
+ selector = 'iframe[title="reCAPTCHA"]'
1786
+ else:
1787
+ return
1788
+ with suppress(Exception):
1789
+ time.sleep(0.08)
1790
+ element_rect = self.get_gui_element_rect(selector, timeout=1)
1791
+ e_x = element_rect["x"]
1792
+ e_y = element_rect["y"]
1793
+ x = e_x + 29
1794
+ y = e_y + 35
1795
+ sb_config._saved_cf_x_y = (x, y)
1796
+ time.sleep(0.08)
1797
+ self.gui_click_x_y(x, y)
1798
+
1763
1799
  def gui_click_captcha(self):
1764
- if not self._on_a_cf_turnstile_page():
1800
+ if self._on_a_cf_turnstile_page():
1801
+ pass
1802
+ elif self._on_a_g_recaptcha_page():
1803
+ self.__gui_click_recaptcha()
1804
+ return
1805
+ else:
1765
1806
  return
1766
1807
  selector = None
1767
1808
  if (
@@ -1926,7 +1967,7 @@ class CDPMethods():
1926
1967
  if not shared_utils.is_windows():
1927
1968
  y = e_y + 32
1928
1969
  else:
1929
- y = e_y + 22
1970
+ y = e_y + 28
1930
1971
  sb_config._saved_cf_x_y = (x, y)
1931
1972
  time.sleep(0.08)
1932
1973
  self.gui_click_x_y(x, y)
@@ -1936,12 +1977,6 @@ class CDPMethods():
1936
1977
  import pyautogui
1937
1978
  pyautogui = self.__get_configured_pyautogui(pyautogui)
1938
1979
  screen_width, screen_height = pyautogui.size()
1939
- if (
1940
- hasattr(sb_config, "_cdp_browser")
1941
- and sb_config._cdp_browser == "opera"
1942
- ):
1943
- x1 = x1 + 55
1944
- x2 = x2 + 55
1945
1980
  if x1 < 0 or y1 < 0 or x1 > screen_width or y1 > screen_height:
1946
1981
  raise Exception(
1947
1982
  "PyAutoGUI cannot drag-drop from point (%s, %s)"
@@ -2033,11 +2068,6 @@ class CDPMethods():
2033
2068
  import pyautogui
2034
2069
  pyautogui = self.__get_configured_pyautogui(pyautogui)
2035
2070
  screen_width, screen_height = pyautogui.size()
2036
- if (
2037
- hasattr(sb_config, "_cdp_browser")
2038
- and sb_config._cdp_browser == "opera"
2039
- ):
2040
- x = x + 55
2041
2071
  if x < 0 or y < 0 or x > screen_width or y > screen_height:
2042
2072
  raise Exception(
2043
2073
  "PyAutoGUI cannot hover on point (%s, %s)"
@@ -2118,7 +2148,7 @@ class CDPMethods():
2118
2148
  if width > 0 and height > 0:
2119
2149
  x, y = self.get_gui_element_center(selector)
2120
2150
  self.bring_active_window_to_front()
2121
- self.__gui_hover_x_y(x, y, timeframe=timeframe)
2151
+ self.__gui_hover_x_y(x, y, timeframe=timeframe, uc_lock=False)
2122
2152
  self.__slow_mode_pause_if_set()
2123
2153
  self.loop.run_until_complete(self.page.wait())
2124
2154
 
File without changes
File without changes
File without changes
File without changes
@@ -387,6 +387,20 @@ class ValidBrowsers:
387
387
  "ie",
388
388
  "safari",
389
389
  "remote",
390
+ "opera",
391
+ "brave",
392
+ "comet",
393
+ "atlas",
394
+ ]
395
+
396
+
397
+ class ChromiumSubs:
398
+ # Chromium browsers that still use chromedriver
399
+ chromium_subs = [
400
+ "opera",
401
+ "brave",
402
+ "comet",
403
+ "atlas",
390
404
  ]
391
405
 
392
406
 
@@ -430,8 +444,12 @@ class ValidBinaries:
430
444
  "Google Chrome Beta",
431
445
  "Google Chrome Dev",
432
446
  "Brave Browser",
447
+ "Brave",
448
+ "Opera Browser",
433
449
  "Opera",
450
+ "Comet Browser",
434
451
  "Comet",
452
+ "Atlas Browser",
435
453
  "Atlas",
436
454
  ]
437
455
  valid_edge_binaries_on_macos = [
@@ -1278,7 +1278,7 @@ def scroll_to_element(driver, element):
1278
1278
  try:
1279
1279
  screen_width = driver.get_window_size()["width"]
1280
1280
  except Exception:
1281
- screen_width = execute_script("return window.innerWidth;")
1281
+ screen_width = execute_script(driver, "return window.innerWidth;")
1282
1282
  element_location_y = element_location_y - constants.Scroll.Y_OFFSET
1283
1283
  if element_location_y < 0:
1284
1284
  element_location_y = 0
@@ -1327,7 +1327,7 @@ def slow_scroll_to_element(driver, element, *args, **kwargs):
1327
1327
  try:
1328
1328
  screen_width = driver.get_window_size()["width"]
1329
1329
  except Exception:
1330
- screen_width = execute_script("return window.innerWidth;")
1330
+ screen_width = execute_script(driver, "return window.innerWidth;")
1331
1331
  element_location_y = element_location_y - constants.Scroll.Y_OFFSET
1332
1332
  if element_location_y < 0:
1333
1333
  element_location_y = 0
@@ -239,6 +239,7 @@ def Driver(
239
239
  from seleniumbase import config as sb_config
240
240
  from seleniumbase.config import settings
241
241
  from seleniumbase.core import browser_launcher
242
+ from seleniumbase.core import detect_b_ver
242
243
  from seleniumbase.fixtures import constants
243
244
  from seleniumbase.fixtures import shared_utils
244
245
 
@@ -271,10 +272,37 @@ def Driver(
271
272
  )
272
273
  elif existing_runner:
273
274
  sb_config._context_of_runner = True
275
+ sb_config._browser_shortcut = None
276
+ sb_config._cdp_browser = None
277
+ sb_config._cdp_bin_loc = None
274
278
  browser_changes = 0
275
279
  browser_set = None
276
280
  browser_text = None
277
281
  browser_list = []
282
+ # Check if binary-location in options
283
+ bin_loc_in_options = False
284
+ if (
285
+ binary_location
286
+ and len(str(binary_location)) > 5
287
+ and os.path.exists(str(binary_location))
288
+ ):
289
+ bin_loc_in_options = True
290
+ else:
291
+ for arg in sys_argv:
292
+ if arg in ["--binary-location", "--binary_location", "--bl"]:
293
+ bin_loc_in_options = True
294
+ if (
295
+ browser
296
+ and browser in constants.ChromiumSubs.chromium_subs
297
+ and not bin_loc_in_options
298
+ ):
299
+ bin_loc = detect_b_ver.get_binary_location(browser)
300
+ if bin_loc and os.path.exists(bin_loc):
301
+ if browser in bin_loc.lower().split("/")[-1].split("\\")[-1]:
302
+ sb_config._cdp_browser = browser
303
+ sb_config._cdp_bin_loc = bin_loc
304
+ binary_location = bin_loc
305
+ bin_loc_in_options = True
278
306
  # As a shortcut, you can use "--edge" instead of "--browser=edge", etc,
279
307
  # but you can only specify one default browser for tests. (Default: chrome)
280
308
  if "--browser=chrome" in sys_argv or "--browser chrome" in sys_argv:
@@ -301,6 +329,46 @@ def Driver(
301
329
  browser_changes += 1
302
330
  browser_set = "remote"
303
331
  browser_list.append("--browser=remote")
332
+ if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
333
+ if not bin_loc_in_options:
334
+ bin_loc = detect_b_ver.get_binary_location("opera")
335
+ if os.path.exists(bin_loc):
336
+ browser_changes += 1
337
+ browser_set = "opera"
338
+ sb_config._browser_shortcut = "opera"
339
+ sb_config._cdp_browser = "opera"
340
+ sb_config._cdp_bin_loc = bin_loc
341
+ browser_list.append("--browser=opera")
342
+ if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
343
+ if not bin_loc_in_options:
344
+ bin_loc = detect_b_ver.get_binary_location("brave")
345
+ if os.path.exists(bin_loc):
346
+ browser_changes += 1
347
+ browser_set = "brave"
348
+ sb_config._browser_shortcut = "brave"
349
+ sb_config._cdp_browser = "brave"
350
+ sb_config._cdp_bin_loc = bin_loc
351
+ browser_list.append("--browser=brave")
352
+ if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
353
+ if not bin_loc_in_options:
354
+ bin_loc = detect_b_ver.get_binary_location("comet")
355
+ if os.path.exists(bin_loc):
356
+ browser_changes += 1
357
+ browser_set = "comet"
358
+ sb_config._browser_shortcut = "comet"
359
+ sb_config._cdp_browser = "comet"
360
+ sb_config._cdp_bin_loc = bin_loc
361
+ browser_list.append("--browser=comet")
362
+ if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
363
+ if not bin_loc_in_options:
364
+ bin_loc = detect_b_ver.get_binary_location("atlas")
365
+ if os.path.exists(bin_loc):
366
+ browser_changes += 1
367
+ browser_set = "atlas"
368
+ sb_config._browser_shortcut = "atlas"
369
+ sb_config._cdp_browser = "atlas"
370
+ sb_config._cdp_bin_loc = bin_loc
371
+ browser_list.append("--browser=atlas")
304
372
  browser_text = browser_set
305
373
  if "--chrome" in sys_argv and not browser_set == "chrome":
306
374
  browser_changes += 1
@@ -322,6 +390,46 @@ def Driver(
322
390
  browser_changes += 1
323
391
  browser_text = "safari"
324
392
  browser_list.append("--safari")
393
+ if "--opera" in sys_argv and not browser_set == "opera":
394
+ if not bin_loc_in_options:
395
+ bin_loc = detect_b_ver.get_binary_location("opera")
396
+ if os.path.exists(bin_loc):
397
+ browser_changes += 1
398
+ browser_text = "opera"
399
+ sb_config._browser_shortcut = "opera"
400
+ sb_config._cdp_browser = "opera"
401
+ sb_config._cdp_bin_loc = bin_loc
402
+ browser_list.append("--opera")
403
+ if "--brave" in sys_argv and not browser_set == "brave":
404
+ if not bin_loc_in_options:
405
+ bin_loc = detect_b_ver.get_binary_location("brave")
406
+ if os.path.exists(bin_loc):
407
+ browser_changes += 1
408
+ browser_text = "brave"
409
+ sb_config._browser_shortcut = "brave"
410
+ sb_config._cdp_browser = "brave"
411
+ sb_config._cdp_bin_loc = bin_loc
412
+ browser_list.append("--brave")
413
+ if "--comet" in sys_argv and not browser_set == "comet":
414
+ if not bin_loc_in_options:
415
+ bin_loc = detect_b_ver.get_binary_location("comet")
416
+ if os.path.exists(bin_loc):
417
+ browser_changes += 1
418
+ browser_text = "comet"
419
+ sb_config._browser_shortcut = "comet"
420
+ sb_config._cdp_browser = "comet"
421
+ sb_config._cdp_bin_loc = bin_loc
422
+ browser_list.append("--comet")
423
+ if "--atlas" in sys_argv and not browser_set == "atlas":
424
+ if not bin_loc_in_options:
425
+ bin_loc = detect_b_ver.get_binary_location("atlas")
426
+ if os.path.exists(bin_loc):
427
+ browser_changes += 1
428
+ browser_text = "atlas"
429
+ sb_config._browser_shortcut = "atlas"
430
+ sb_config._cdp_browser = "atlas"
431
+ sb_config._cdp_bin_loc = bin_loc
432
+ browser_list.append("--atlas")
325
433
  if browser_changes > 1:
326
434
  message = "\n\n TOO MANY browser types were entered!"
327
435
  message += "\n There were %s found:\n > %s" % (
@@ -345,6 +453,10 @@ def Driver(
345
453
  "Browser: {%s} is not a valid browser option. "
346
454
  "Valid options = {%s}" % (browser, valid_browsers)
347
455
  )
456
+ if sb_config._browser_shortcut:
457
+ browser = sb_config._browser_shortcut
458
+ if browser in constants.ChromiumSubs.chromium_subs:
459
+ browser = "chrome" # Still uses chromedriver
348
460
  if headless is None:
349
461
  if "--headless" in sys_argv:
350
462
  headless = True
@@ -534,6 +646,8 @@ def Driver(
534
646
  count += 1
535
647
  user_agent = agent
536
648
  found_bl = None
649
+ if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
650
+ binary_location = sb_config._cdp_bin_loc
537
651
  if binary_location is None and "--binary-location" in arg_join:
538
652
  count = 0
539
653
  for arg in sys_argv:
@@ -7,6 +7,7 @@ import time
7
7
  from contextlib import suppress
8
8
  from seleniumbase import config as sb_config
9
9
  from seleniumbase.config import settings
10
+ from seleniumbase.core import detect_b_ver
10
11
  from seleniumbase.core import log_helper
11
12
  from seleniumbase.fixtures import constants
12
13
  from seleniumbase.fixtures import shared_utils
@@ -28,6 +29,10 @@ def pytest_addoption(parser):
28
29
  --edge (Shortcut for "--browser=edge".)
29
30
  --firefox (Shortcut for "--browser=firefox".)
30
31
  --safari (Shortcut for "--browser=safari".)
32
+ --opera (Shortcut for "--browser=opera".)
33
+ --brave (Shortcut for "--browser=brave".)
34
+ --comet (Shortcut for "--browser=comet".)
35
+ --atlas (Shortcut for "--browser=atlas".)
31
36
  --cft (Shortcut for using `Chrome for Testing`)
32
37
  --chs (Shortcut for using `Chrome-Headless-Shell`)
33
38
  --settings-file=FILE (Override default SeleniumBase settings.)
@@ -186,6 +191,34 @@ def pytest_addoption(parser):
186
191
  default=False,
187
192
  help="""Shortcut for --browser=safari""",
188
193
  )
194
+ parser.addoption(
195
+ "--opera",
196
+ action="store_true",
197
+ dest="use_opera",
198
+ default=False,
199
+ help="""Shortcut for --browser=opera""",
200
+ )
201
+ parser.addoption(
202
+ "--brave",
203
+ action="store_true",
204
+ dest="use_brave",
205
+ default=False,
206
+ help="""Shortcut for --browser=brave""",
207
+ )
208
+ parser.addoption(
209
+ "--comet",
210
+ action="store_true",
211
+ dest="use_comet",
212
+ default=False,
213
+ help="""Shortcut for --browser=comet""",
214
+ )
215
+ parser.addoption(
216
+ "--atlas",
217
+ action="store_true",
218
+ dest="use_atlas",
219
+ default=False,
220
+ help="""Shortcut for --browser=atlas""",
221
+ )
189
222
  parser.addoption(
190
223
  "--cft",
191
224
  action="store_true",
@@ -1388,8 +1421,14 @@ def pytest_addoption(parser):
1388
1421
 
1389
1422
  arg_join = " ".join(sys_argv)
1390
1423
  sb_config._browser_shortcut = None
1424
+ sb_config._cdp_browser = None
1425
+ sb_config._cdp_bin_loc = None
1391
1426
  sb_config._vd_list = []
1392
-
1427
+ # Check if binary-location in options
1428
+ bin_loc_in_options = False
1429
+ for arg in sys_argv:
1430
+ if arg in ["--binary-location", "--binary_location", "--bl"]:
1431
+ bin_loc_in_options = True
1393
1432
  # SeleniumBase does not support pytest-timeout due to hanging browsers.
1394
1433
  for arg in sys_argv:
1395
1434
  if "--timeout=" in arg:
@@ -1465,6 +1504,46 @@ def pytest_addoption(parser):
1465
1504
  browser_changes += 1
1466
1505
  browser_set = "remote"
1467
1506
  browser_list.append("--browser=remote")
1507
+ if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
1508
+ if not bin_loc_in_options:
1509
+ bin_loc = detect_b_ver.get_binary_location("opera")
1510
+ if os.path.exists(bin_loc):
1511
+ browser_changes += 1
1512
+ browser_set = "opera"
1513
+ sb_config._browser_shortcut = "opera"
1514
+ sb_config._cdp_browser = "opera"
1515
+ sb_config._cdp_bin_loc = bin_loc
1516
+ browser_list.append("--browser=opera")
1517
+ if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
1518
+ if not bin_loc_in_options:
1519
+ bin_loc = detect_b_ver.get_binary_location("brave")
1520
+ if os.path.exists(bin_loc):
1521
+ browser_changes += 1
1522
+ browser_set = "brave"
1523
+ sb_config._browser_shortcut = "brave"
1524
+ sb_config._cdp_browser = "brave"
1525
+ sb_config._cdp_bin_loc = bin_loc
1526
+ browser_list.append("--browser=brave")
1527
+ if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
1528
+ if not bin_loc_in_options:
1529
+ bin_loc = detect_b_ver.get_binary_location("comet")
1530
+ if os.path.exists(bin_loc):
1531
+ browser_changes += 1
1532
+ browser_set = "comet"
1533
+ sb_config._browser_shortcut = "comet"
1534
+ sb_config._cdp_browser = "comet"
1535
+ sb_config._cdp_bin_loc = bin_loc
1536
+ browser_list.append("--browser=comet")
1537
+ if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
1538
+ if not bin_loc_in_options:
1539
+ bin_loc = detect_b_ver.get_binary_location("atlas")
1540
+ if os.path.exists(bin_loc):
1541
+ browser_changes += 1
1542
+ browser_set = "atlas"
1543
+ sb_config._browser_shortcut = "atlas"
1544
+ sb_config._cdp_browser = "atlas"
1545
+ sb_config._cdp_bin_loc = bin_loc
1546
+ browser_list.append("--browser=atlas")
1468
1547
  browser_text = browser_set
1469
1548
  if "--chrome" in sys_argv and not browser_set == "chrome":
1470
1549
  browser_changes += 1
@@ -1491,6 +1570,46 @@ def pytest_addoption(parser):
1491
1570
  browser_text = "safari"
1492
1571
  sb_config._browser_shortcut = "safari"
1493
1572
  browser_list.append("--safari")
1573
+ if "--opera" in sys_argv and not browser_set == "opera":
1574
+ if not bin_loc_in_options:
1575
+ bin_loc = detect_b_ver.get_binary_location("opera")
1576
+ if os.path.exists(bin_loc):
1577
+ browser_changes += 1
1578
+ browser_text = "opera"
1579
+ sb_config._browser_shortcut = "opera"
1580
+ sb_config._cdp_browser = "opera"
1581
+ sb_config._cdp_bin_loc = bin_loc
1582
+ browser_list.append("--opera")
1583
+ if "--brave" in sys_argv and not browser_set == "brave":
1584
+ if not bin_loc_in_options:
1585
+ bin_loc = detect_b_ver.get_binary_location("brave")
1586
+ if os.path.exists(bin_loc):
1587
+ browser_changes += 1
1588
+ browser_text = "brave"
1589
+ sb_config._browser_shortcut = "brave"
1590
+ sb_config._cdp_browser = "brave"
1591
+ sb_config._cdp_bin_loc = bin_loc
1592
+ browser_list.append("--brave")
1593
+ if "--comet" in sys_argv and not browser_set == "comet":
1594
+ if not bin_loc_in_options:
1595
+ bin_loc = detect_b_ver.get_binary_location("comet")
1596
+ if os.path.exists(bin_loc):
1597
+ browser_changes += 1
1598
+ browser_text = "comet"
1599
+ sb_config._browser_shortcut = "comet"
1600
+ sb_config._cdp_browser = "comet"
1601
+ sb_config._cdp_bin_loc = bin_loc
1602
+ browser_list.append("--comet")
1603
+ if "--atlas" in sys_argv and not browser_set == "atlas":
1604
+ if not bin_loc_in_options:
1605
+ bin_loc = detect_b_ver.get_binary_location("atlas")
1606
+ if os.path.exists(bin_loc):
1607
+ browser_changes += 1
1608
+ browser_text = "atlas"
1609
+ sb_config._browser_shortcut = "atlas"
1610
+ sb_config._cdp_browser = "atlas"
1611
+ sb_config._cdp_bin_loc = bin_loc
1612
+ browser_list.append("--atlas")
1494
1613
  if browser_changes > 1:
1495
1614
  message = "\n TOO MANY browser types were entered!"
1496
1615
  message += "\n There were %s found:\n > %s" % (
@@ -1525,7 +1644,7 @@ def pytest_addoption(parser):
1525
1644
  undetectable = True
1526
1645
  if (
1527
1646
  browser_changes == 1
1528
- and browser_text not in ["chrome"]
1647
+ and browser_text not in ["chrome", "opera", "brave", "comet", "atlas"]
1529
1648
  and undetectable
1530
1649
  ):
1531
1650
  message = (
@@ -1557,6 +1676,8 @@ def pytest_configure(config):
1557
1676
  sb_config.browser = config.getoption("browser")
1558
1677
  if sb_config._browser_shortcut:
1559
1678
  sb_config.browser = sb_config._browser_shortcut
1679
+ if sb_config.browser in constants.ChromiumSubs.chromium_subs:
1680
+ sb_config.browser = "chrome" # Still uses chromedriver
1560
1681
  sb_config.account = config.getoption("account")
1561
1682
  sb_config.data = config.getoption("data")
1562
1683
  sb_config.var1 = config.getoption("var1")
@@ -1591,6 +1712,8 @@ def pytest_configure(config):
1591
1712
  sb_config.extension_dir = config.getoption("extension_dir")
1592
1713
  sb_config.disable_features = config.getoption("disable_features")
1593
1714
  sb_config.binary_location = config.getoption("binary_location")
1715
+ if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
1716
+ sb_config.binary_location = sb_config._cdp_bin_loc
1594
1717
  if config.getoption("use_cft") and not sb_config.binary_location:
1595
1718
  sb_config.binary_location = "cft"
1596
1719
  elif config.getoption("use_chs") and not sb_config.binary_location:
@@ -267,6 +267,7 @@ def SB(
267
267
  import traceback
268
268
  from seleniumbase import config as sb_config
269
269
  from seleniumbase.config import settings
270
+ from seleniumbase.core import detect_b_ver
270
271
  from seleniumbase.fixtures import constants
271
272
  from seleniumbase.fixtures import shared_utils
272
273
 
@@ -334,10 +335,37 @@ def SB(
334
335
  raise_test_failure = True # Exit on first error or failed test.
335
336
  else:
336
337
  raise_test_failure = False
338
+ sb_config._browser_shortcut = None
339
+ sb_config._cdp_browser = None
340
+ sb_config._cdp_bin_loc = None
337
341
  browser_changes = 0
338
342
  browser_set = None
339
343
  browser_text = None
340
344
  browser_list = []
345
+ # Check if binary-location in options
346
+ bin_loc_in_options = False
347
+ if (
348
+ binary_location
349
+ and len(str(binary_location)) > 5
350
+ and os.path.exists(str(binary_location))
351
+ ):
352
+ bin_loc_in_options = True
353
+ else:
354
+ for arg in sys_argv:
355
+ if arg in ["--binary-location", "--binary_location", "--bl"]:
356
+ bin_loc_in_options = True
357
+ if (
358
+ browser
359
+ and browser in constants.ChromiumSubs.chromium_subs
360
+ and not bin_loc_in_options
361
+ ):
362
+ bin_loc = detect_b_ver.get_binary_location(browser)
363
+ if bin_loc and os.path.exists(bin_loc):
364
+ if browser in bin_loc.lower().split("/")[-1].split("\\")[-1]:
365
+ sb_config._cdp_browser = browser
366
+ sb_config._cdp_bin_loc = bin_loc
367
+ binary_location = bin_loc
368
+ bin_loc_in_options = True
341
369
  # As a shortcut, you can use "--edge" instead of "--browser=edge", etc,
342
370
  # but you can only specify one default browser for tests. (Default: chrome)
343
371
  if "--browser=chrome" in sys_argv or "--browser chrome" in sys_argv:
@@ -364,6 +392,46 @@ def SB(
364
392
  browser_changes += 1
365
393
  browser_set = "remote"
366
394
  browser_list.append("--browser=remote")
395
+ if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
396
+ if not bin_loc_in_options:
397
+ bin_loc = detect_b_ver.get_binary_location("opera")
398
+ if os.path.exists(bin_loc):
399
+ browser_changes += 1
400
+ browser_set = "opera"
401
+ sb_config._browser_shortcut = "opera"
402
+ sb_config._cdp_browser = "opera"
403
+ sb_config._cdp_bin_loc = bin_loc
404
+ browser_list.append("--browser=opera")
405
+ if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
406
+ if not bin_loc_in_options:
407
+ bin_loc = detect_b_ver.get_binary_location("brave")
408
+ if os.path.exists(bin_loc):
409
+ browser_changes += 1
410
+ browser_set = "brave"
411
+ sb_config._browser_shortcut = "brave"
412
+ sb_config._cdp_browser = "brave"
413
+ sb_config._cdp_bin_loc = bin_loc
414
+ browser_list.append("--browser=brave")
415
+ if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
416
+ if not bin_loc_in_options:
417
+ bin_loc = detect_b_ver.get_binary_location("comet")
418
+ if os.path.exists(bin_loc):
419
+ browser_changes += 1
420
+ browser_set = "comet"
421
+ sb_config._browser_shortcut = "comet"
422
+ sb_config._cdp_browser = "comet"
423
+ sb_config._cdp_bin_loc = bin_loc
424
+ browser_list.append("--browser=comet")
425
+ if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
426
+ if not bin_loc_in_options:
427
+ bin_loc = detect_b_ver.get_binary_location("atlas")
428
+ if os.path.exists(bin_loc):
429
+ browser_changes += 1
430
+ browser_set = "atlas"
431
+ sb_config._browser_shortcut = "atlas"
432
+ sb_config._cdp_browser = "atlas"
433
+ sb_config._cdp_bin_loc = bin_loc
434
+ browser_list.append("--browser=atlas")
367
435
  browser_text = browser_set
368
436
  if "--chrome" in sys_argv and not browser_set == "chrome":
369
437
  browser_changes += 1
@@ -390,6 +458,46 @@ def SB(
390
458
  browser_text = "safari"
391
459
  sb_config._browser_shortcut = "safari"
392
460
  browser_list.append("--safari")
461
+ if "--opera" in sys_argv and not browser_set == "opera":
462
+ if not bin_loc_in_options:
463
+ bin_loc = detect_b_ver.get_binary_location("opera")
464
+ if os.path.exists(bin_loc):
465
+ browser_changes += 1
466
+ browser_text = "opera"
467
+ sb_config._browser_shortcut = "opera"
468
+ sb_config._cdp_browser = "opera"
469
+ sb_config._cdp_bin_loc = bin_loc
470
+ browser_list.append("--opera")
471
+ if "--brave" in sys_argv and not browser_set == "brave":
472
+ if not bin_loc_in_options:
473
+ bin_loc = detect_b_ver.get_binary_location("brave")
474
+ if os.path.exists(bin_loc):
475
+ browser_changes += 1
476
+ browser_text = "brave"
477
+ sb_config._browser_shortcut = "brave"
478
+ sb_config._cdp_browser = "brave"
479
+ sb_config._cdp_bin_loc = bin_loc
480
+ browser_list.append("--brave")
481
+ if "--comet" in sys_argv and not browser_set == "comet":
482
+ if not bin_loc_in_options:
483
+ bin_loc = detect_b_ver.get_binary_location("comet")
484
+ if os.path.exists(bin_loc):
485
+ browser_changes += 1
486
+ browser_text = "comet"
487
+ sb_config._browser_shortcut = "comet"
488
+ sb_config._cdp_browser = "comet"
489
+ sb_config._cdp_bin_loc = bin_loc
490
+ browser_list.append("--comet")
491
+ if "--atlas" in sys_argv and not browser_set == "atlas":
492
+ if not bin_loc_in_options:
493
+ bin_loc = detect_b_ver.get_binary_location("atlas")
494
+ if os.path.exists(bin_loc):
495
+ browser_changes += 1
496
+ browser_text = "atlas"
497
+ sb_config._browser_shortcut = "atlas"
498
+ sb_config._cdp_browser = "atlas"
499
+ sb_config._cdp_bin_loc = bin_loc
500
+ browser_list.append("--atlas")
393
501
  if browser_changes > 1:
394
502
  message = "\n\n TOO MANY browser types were entered!"
395
503
  message += "\n There were %s found:\n > %s" % (
@@ -692,7 +800,10 @@ def SB(
692
800
  uc_cdp_events = True
693
801
  else:
694
802
  uc_cdp_events = False
695
- if undetectable and browser != "chrome":
803
+ if (
804
+ undetectable
805
+ and browser not in ["chrome", "opera", "brave", "comet", "atlas"]
806
+ ):
696
807
  message = (
697
808
  '\n Undetected-Chromedriver Mode ONLY supports Chrome!'
698
809
  '\n ("uc=True" / "undetectable=True" / "--uc")'
@@ -1019,6 +1130,10 @@ def SB(
1019
1130
 
1020
1131
  sb_config.with_testing_base = with_testing_base
1021
1132
  sb_config.browser = browser
1133
+ if sb_config._browser_shortcut:
1134
+ sb_config.browser = sb_config._browser_shortcut
1135
+ if sb_config.browser in constants.ChromiumSubs.chromium_subs:
1136
+ sb_config.browser = "chrome" # Still uses chromedriver
1022
1137
  if not hasattr(sb_config, "is_behave"):
1023
1138
  sb_config.is_behave = False
1024
1139
  if not hasattr(sb_config, "is_pytest"):
@@ -1082,6 +1197,8 @@ def SB(
1082
1197
  sb_config.save_screenshot = save_screenshot
1083
1198
  sb_config.no_screenshot = no_screenshot
1084
1199
  sb_config.binary_location = binary_location
1200
+ if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
1201
+ sb_config.binary_location = sb_config._cdp_bin_loc
1085
1202
  sb_config.driver_version = driver_version
1086
1203
  sb_config.page_load_strategy = page_load_strategy
1087
1204
  sb_config.timeout_multiplier = timeout_multiplier
@@ -1,9 +1,11 @@
1
1
  """Selenium Plugin for SeleniumBase tests that run with pynose / nosetests"""
2
+ import os
2
3
  import sys
3
4
  from contextlib import suppress
4
5
  from nose.plugins import Plugin
5
6
  from seleniumbase import config as sb_config
6
7
  from seleniumbase.config import settings
8
+ from seleniumbase.core import detect_b_ver
7
9
  from seleniumbase.core import proxy_helper
8
10
  from seleniumbase.fixtures import constants
9
11
  from seleniumbase.fixtures import shared_utils
@@ -16,6 +18,10 @@ class SeleniumBrowser(Plugin):
16
18
  --edge (Shortcut for "--browser=edge".)
17
19
  --firefox (Shortcut for "--browser=firefox".)
18
20
  --safari (Shortcut for "--browser=safari".)
21
+ --opera (Shortcut for "--browser=opera".)
22
+ --brave (Shortcut for "--browser=brave".)
23
+ --comet (Shortcut for "--browser=comet".)
24
+ --atlas (Shortcut for "--browser=atlas".)
19
25
  --cft (Shortcut for using `Chrome for Testing`)
20
26
  --chs (Shortcut for using `Chrome-Headless-Shell`)
21
27
  --user-data-dir=DIR (Set the Chrome user data directory to use.)
@@ -146,6 +152,34 @@ class SeleniumBrowser(Plugin):
146
152
  default=False,
147
153
  help="""Shortcut for --browser=safari""",
148
154
  )
155
+ parser.addoption(
156
+ "--opera",
157
+ action="store_true",
158
+ dest="use_opera",
159
+ default=False,
160
+ help="""Shortcut for --browser=opera""",
161
+ )
162
+ parser.addoption(
163
+ "--brave",
164
+ action="store_true",
165
+ dest="use_brave",
166
+ default=False,
167
+ help="""Shortcut for --browser=brave""",
168
+ )
169
+ parser.addoption(
170
+ "--comet",
171
+ action="store_true",
172
+ dest="use_comet",
173
+ default=False,
174
+ help="""Shortcut for --browser=comet""",
175
+ )
176
+ parser.addoption(
177
+ "--atlas",
178
+ action="store_true",
179
+ dest="use_atlas",
180
+ default=False,
181
+ help="""Shortcut for --browser=atlas""",
182
+ )
149
183
  parser.addoption(
150
184
  "--cft",
151
185
  action="store_true",
@@ -1057,6 +1091,11 @@ class SeleniumBrowser(Plugin):
1057
1091
  browser_set = None
1058
1092
  browser_text = None
1059
1093
  browser_list = []
1094
+ # Check if binary-location in options
1095
+ bin_loc_in_options = False
1096
+ for arg in sys_argv:
1097
+ if arg in ["--binary-location", "--binary_location", "--bl"]:
1098
+ bin_loc_in_options = True
1060
1099
  if "--browser=chrome" in sys_argv or "--browser chrome" in sys_argv:
1061
1100
  browser_changes += 1
1062
1101
  browser_set = "chrome"
@@ -1081,6 +1120,46 @@ class SeleniumBrowser(Plugin):
1081
1120
  browser_changes += 1
1082
1121
  browser_set = "remote"
1083
1122
  browser_list.append("--browser=remote")
1123
+ if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
1124
+ if not bin_loc_in_options:
1125
+ bin_loc = detect_b_ver.get_binary_location("opera")
1126
+ if os.path.exists(bin_loc):
1127
+ browser_changes += 1
1128
+ browser_set = "opera"
1129
+ sb_config._browser_shortcut = "opera"
1130
+ sb_config._cdp_browser = "opera"
1131
+ sb_config._cdp_bin_loc = bin_loc
1132
+ browser_list.append("--browser=opera")
1133
+ if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
1134
+ if not bin_loc_in_options:
1135
+ bin_loc = detect_b_ver.get_binary_location("brave")
1136
+ if os.path.exists(bin_loc):
1137
+ browser_changes += 1
1138
+ browser_set = "brave"
1139
+ sb_config._browser_shortcut = "brave"
1140
+ sb_config._cdp_browser = "brave"
1141
+ sb_config._cdp_bin_loc = bin_loc
1142
+ browser_list.append("--browser=brave")
1143
+ if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
1144
+ if not bin_loc_in_options:
1145
+ bin_loc = detect_b_ver.get_binary_location("comet")
1146
+ if os.path.exists(bin_loc):
1147
+ browser_changes += 1
1148
+ browser_set = "comet"
1149
+ sb_config._browser_shortcut = "comet"
1150
+ sb_config._cdp_browser = "comet"
1151
+ sb_config._cdp_bin_loc = bin_loc
1152
+ browser_list.append("--browser=comet")
1153
+ if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
1154
+ if not bin_loc_in_options:
1155
+ bin_loc = detect_b_ver.get_binary_location("atlas")
1156
+ if os.path.exists(bin_loc):
1157
+ browser_changes += 1
1158
+ browser_set = "atlas"
1159
+ sb_config._browser_shortcut = "atlas"
1160
+ sb_config._cdp_browser = "atlas"
1161
+ sb_config._cdp_bin_loc = bin_loc
1162
+ browser_list.append("--browser=atlas")
1084
1163
  browser_text = browser_set
1085
1164
  if "--chrome" in sys_argv and not browser_set == "chrome":
1086
1165
  browser_changes += 1
@@ -1107,6 +1186,46 @@ class SeleniumBrowser(Plugin):
1107
1186
  browser_text = "safari"
1108
1187
  sb_config._browser_shortcut = "safari"
1109
1188
  browser_list.append("--safari")
1189
+ if "--opera" in sys_argv and not browser_set == "opera":
1190
+ if not bin_loc_in_options:
1191
+ bin_loc = detect_b_ver.get_binary_location("opera")
1192
+ if os.path.exists(bin_loc):
1193
+ browser_changes += 1
1194
+ browser_text = "opera"
1195
+ sb_config._browser_shortcut = "opera"
1196
+ sb_config._cdp_browser = "opera"
1197
+ sb_config._cdp_bin_loc = bin_loc
1198
+ browser_list.append("--opera")
1199
+ if "--brave" in sys_argv and not browser_set == "brave":
1200
+ if not bin_loc_in_options:
1201
+ bin_loc = detect_b_ver.get_binary_location("brave")
1202
+ if os.path.exists(bin_loc):
1203
+ browser_changes += 1
1204
+ browser_text = "brave"
1205
+ sb_config._browser_shortcut = "brave"
1206
+ sb_config._cdp_browser = "brave"
1207
+ sb_config._cdp_bin_loc = bin_loc
1208
+ browser_list.append("--brave")
1209
+ if "--comet" in sys_argv and not browser_set == "comet":
1210
+ if not bin_loc_in_options:
1211
+ bin_loc = detect_b_ver.get_binary_location("comet")
1212
+ if os.path.exists(bin_loc):
1213
+ browser_changes += 1
1214
+ browser_text = "comet"
1215
+ sb_config._browser_shortcut = "comet"
1216
+ sb_config._cdp_browser = "comet"
1217
+ sb_config._cdp_bin_loc = bin_loc
1218
+ browser_list.append("--comet")
1219
+ if "--atlas" in sys_argv and not browser_set == "atlas":
1220
+ if not bin_loc_in_options:
1221
+ bin_loc = detect_b_ver.get_binary_location("atlas")
1222
+ if os.path.exists(bin_loc):
1223
+ browser_changes += 1
1224
+ browser_text = "atlas"
1225
+ sb_config._browser_shortcut = "atlas"
1226
+ sb_config._cdp_browser = "atlas"
1227
+ sb_config._cdp_bin_loc = bin_loc
1228
+ browser_list.append("--atlas")
1110
1229
  if browser_changes > 1:
1111
1230
  message = "\n\n TOO MANY browser types were entered!"
1112
1231
  message += "\n There were %s found:\n > %s" % (
@@ -1183,6 +1302,8 @@ class SeleniumBrowser(Plugin):
1183
1302
  if sb_config._browser_shortcut:
1184
1303
  self.options.browser = sb_config._browser_shortcut
1185
1304
  test.test.browser = sb_config._browser_shortcut
1305
+ if test.test.browser in constants.ChromiumSubs.chromium_subs:
1306
+ test.test.browser = "chrome" # Still uses chromedriver
1186
1307
  test.test.cap_file = self.options.cap_file
1187
1308
  test.test.cap_string = self.options.cap_string
1188
1309
  test.test.headless = self.options.headless
@@ -1219,6 +1340,8 @@ class SeleniumBrowser(Plugin):
1219
1340
  test.test.extension_dir = self.options.extension_dir
1220
1341
  test.test.disable_features = self.options.disable_features
1221
1342
  test.test.binary_location = self.options.binary_location
1343
+ if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
1344
+ test.test.binary_location = sb_config._cdp_bin_loc
1222
1345
  if self.options.use_cft and not test.test.binary_location:
1223
1346
  test.test.binary_location = "cft"
1224
1347
  elif self.options.use_chs and not test.test.binary_location:
@@ -593,6 +593,20 @@ async def start(
593
593
  browser_binary = detect_b_ver.get_binary_location(browser)
594
594
  if browser_binary and os.path.exists(browser_binary):
595
595
  browser_executable_path = browser_binary
596
+ else:
597
+ bin_loc = str(browser_executable_path).lower()
598
+ if bin_loc.endswith("opera") or bin_loc.endswith("opera.exe"):
599
+ sb_config._cdp_browser = "opera"
600
+ elif bin_loc.endswith("edge") or bin_loc.endswith("edge.exe"):
601
+ sb_config._cdp_browser = "edge"
602
+ elif bin_loc.endswith("brave") or bin_loc.endswith("brave.exe"):
603
+ sb_config._cdp_browser = "brave"
604
+ elif bin_loc.endswith("comet") or bin_loc.endswith("comet.exe"):
605
+ sb_config._cdp_browser = "comet"
606
+ elif bin_loc.endswith("atlas") or bin_loc.endswith("atlas.exe"):
607
+ sb_config._cdp_browser = "atlas"
608
+ else:
609
+ sb_config._cdp_browser = "chrome"
596
610
  if not config:
597
611
  config = Config(
598
612
  user_data_dir,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seleniumbase
3
- Version: 4.43.2
3
+ Version: 4.43.3
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
@@ -871,6 +871,10 @@ pytest test_coffee_cart.py --trace
871
871
  --edge # (Shortcut for "--browser=edge".)
872
872
  --firefox # (Shortcut for "--browser=firefox".)
873
873
  --safari # (Shortcut for "--browser=safari".)
874
+ --opera # (Shortcut for "--browser=opera".)
875
+ --brave # (Shortcut for "--browser=brave".)
876
+ --comet # (Shortcut for "--browser=comet".)
877
+ --atlas # (Shortcut for "--browser=atlas".)
874
878
  --settings-file=FILE # (Override default SeleniumBase settings.)
875
879
  --env=ENV # (Set the test env. Access with "self.env" in tests.)
876
880
  --account=STR # (Set account. Access with "self.account" in tests.)
@@ -3,7 +3,7 @@ sbase/__main__.py,sha256=G0bVB1-DM4PGwQ1KyOupaWCs4ePbChZNNWuX2htim5U,647
3
3
  sbase/steps.py,sha256=wiPSWZhFpBlWvkqXRJ18btpBu3nQaw9K5AzIJNAX5RM,43521
4
4
  seleniumbase/__init__.py,sha256=JFEY9P5QJqsa1M6ghzLMH2eIPQyh85iglCaQwg8Y8z4,2498
5
5
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
6
- seleniumbase/__version__.py,sha256=IQ2WDeQ_4MfHyoSgvu_2-ih5qghfA48WDHKFexvo30E,46
6
+ seleniumbase/__version__.py,sha256=9cDyvBSzC_bfVjqEGyGEi6MIO0NgsOhbKabZPIUihyE,46
7
7
  seleniumbase/behave/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  seleniumbase/behave/behave_helper.py,sha256=lJtagtivSbEpbRj0EKV4l4PuPU6NANONJJAnYwgVCe0,24379
9
9
  seleniumbase/behave/behave_sb.py,sha256=dEj9UUHVz3ejzEX25frViPQfp7acjI-UssWJO_wpugg,59875
@@ -36,11 +36,11 @@ seleniumbase/console_scripts/sb_print.py,sha256=iUKR71Y82NhuKBKw31PJilDw-pPUr-vq
36
36
  seleniumbase/console_scripts/sb_recorder.py,sha256=DH-n2fN7N9qyHMl7wjtn8MiliBgfw-1kwgmfg1GUuhk,10772
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=bFw-98X5_2H1BkwrEs6kpQKIxrjx7c0KG3Th0Yeeksg,251499
39
+ seleniumbase/core/browser_launcher.py,sha256=NWLi2Yr1Rk9vnaJ1-92cKvdwgjNny05VFs3i0R75z24,254523
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
43
- seleniumbase/core/detect_b_ver.py,sha256=RDupAIVtXo3v5jOspJnhnatqUJh5jeTxwfPlFjz9WXY,21647
43
+ seleniumbase/core/detect_b_ver.py,sha256=kSm7I2GIJT5uNLbmxRIr7M0ADQsTo9oyC_QmuS0IdMU,21644
44
44
  seleniumbase/core/download_helper.py,sha256=qSR54kQISucF4RQaLCOuuerSu6DR41juGi_30HVvWYY,2943
45
45
  seleniumbase/core/encoded_images.py,sha256=rDKJ4cNJSuKiRcFViYU7bjyTS9_moI57gUPRXVg3u2k,14209
46
46
  seleniumbase/core/jqc_helper.py,sha256=2DDQr9Q2jSSZqFzX588jLlUM9oJvyrRWq2aORSIPUdI,10322
@@ -50,7 +50,7 @@ seleniumbase/core/proxy_helper.py,sha256=pZ1NboNfziHU3vWZLOZLX-qkfM3oKSnpc3omQf9
50
50
  seleniumbase/core/recorder_helper.py,sha256=gDION28OK4NAYsE-7ohKZ9Z3sxQQ0FEjf859LDpqsg4,25320
51
51
  seleniumbase/core/report_helper.py,sha256=Obg5wHltEmM6uFCWFeR8_fjeT0GzHjGgoqQIr_HUxxk,12223
52
52
  seleniumbase/core/s3_manager.py,sha256=z_4qx2jI_gtK5r3niGXgEOBpfMUicUCOciowai50MP4,3529
53
- seleniumbase/core/sb_cdp.py,sha256=Kj5iOD8IuJwctPLFLZg9Xlam_S4qOXY-yjJ6IiLyXxs,108287
53
+ seleniumbase/core/sb_cdp.py,sha256=B55mkFUCtMxeiAcUMa9N0Gzucr0Mv4_VLxWVyNv9vxg,109378
54
54
  seleniumbase/core/sb_driver.py,sha256=-IQsskc7HpXQbcBL04IPjmGpyYchyo7v9OPF2WcahDw,14159
55
55
  seleniumbase/core/session_helper.py,sha256=s9zD3PVZEWVzG2h81cCUskbNWLfdjC_LwwQjKptHCak,558
56
56
  seleniumbase/core/settings_parser.py,sha256=gqVohHVlE_5L5Cqe2L24uYrRzvoK-saX8E_Df7_-_3I,7609
@@ -59,8 +59,12 @@ seleniumbase/core/testcase_manager.py,sha256=TblCfo8Zfap1Bayip-qTu9gqT-KALSwXAX4
59
59
  seleniumbase/core/tour_helper.py,sha256=GcNHetXiM8D2Z0-TLEF-LlBaPHADdT-n2HNlft9Sup0,42535
60
60
  seleniumbase/core/visual_helper.py,sha256=HxPOulfEebc9ZSwe7E-nSQJ12N2l4vhqUQubLvE2QQw,3227
61
61
  seleniumbase/drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
+ seleniumbase/drivers/atlas_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
+ seleniumbase/drivers/brave_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
64
  seleniumbase/drivers/cft_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
65
  seleniumbase/drivers/chs_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
+ seleniumbase/drivers/comet_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
+ seleniumbase/drivers/opera_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
68
  seleniumbase/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
69
  seleniumbase/extensions/ad_block.zip,sha256=LTlaOYUs6a1Zu4op64pLoDEqYKJb8zHq_Y0PsBIIqCk,1454
66
70
  seleniumbase/extensions/disable_csp.zip,sha256=5RvomXnm2PdivUVcxTV6jfvD8WhTEsQYHaQZe7nk9Yc,20014
@@ -68,10 +72,10 @@ seleniumbase/extensions/recorder.zip,sha256=JEE_FVEvlS63cFQbVLEroIyPSS91nWCDL0Mh
68
72
  seleniumbase/extensions/sbase_ext.zip,sha256=3s1N8zrVaMz8RQEOIoBzC3KDjtmHwVZRvVsX25Odr_s,8175
69
73
  seleniumbase/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
74
  seleniumbase/fixtures/base_case.py,sha256=NbQNMpYCLDNLz3OMBh8eKRu0SHhAKD1Kvci-ZrvZbEw,741284
71
- seleniumbase/fixtures/constants.py,sha256=r2NqXXDpFH-A4B67XDg5OdtNVW1Pug0nvj6GeeVAZQ4,14021
75
+ seleniumbase/fixtures/constants.py,sha256=zI6zEaWUNXaapeWP2kYvV_ubTI854tSV_iDpVmF7pR4,14351
72
76
  seleniumbase/fixtures/css_to_xpath.py,sha256=9ouDB1xl4MJ2os6JOgTIAyHKOQfuxtxvXC3O5hSnEKA,1954
73
77
  seleniumbase/fixtures/errors.py,sha256=KyxuEVx_e3MPhVrJfNIa_3ltMpbCFxfy_jxK8RFNTns,555
74
- seleniumbase/fixtures/js_utils.py,sha256=F2fcuYZb2PDLOHSurLjlprlg58jZHwIBth9Y7NG3_eA,52827
78
+ seleniumbase/fixtures/js_utils.py,sha256=iNMn4soCRIuyjYG0vUHZX5zWEKSR8RgGDsl9Y74DFP8,52843
75
79
  seleniumbase/fixtures/page_actions.py,sha256=QV5VPNoa8djy7CpThtqk5c2rKBqNPscFJRIpaLE_3no,73192
76
80
  seleniumbase/fixtures/page_utils.py,sha256=auaUAuV2ctRNPUnGWuHS22Il0Ml0PPHmxtikVZdM2tc,12277
77
81
  seleniumbase/fixtures/shared_utils.py,sha256=kn0rcF0tEkQkiT8RGVooNFsLnVWmdPeTH9PfIm86TOI,10527
@@ -88,13 +92,13 @@ seleniumbase/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
88
92
  seleniumbase/plugins/base_plugin.py,sha256=ItLgtaZmu_363iycy8BNX0Do5LyIWGiTMLW6krXM-WQ,14748
89
93
  seleniumbase/plugins/basic_test_info.py,sha256=nvQxLMxD4pgjY3dGHlMAxmHXP0LIhcOIfWjNue-49uk,2108
90
94
  seleniumbase/plugins/db_reporting_plugin.py,sha256=En09qUCoojrk9-vbcnsoHdSELoGmag2GDIyu3jTiJas,7331
91
- seleniumbase/plugins/driver_manager.py,sha256=VSYQgDDA2t34gi-3qPkw5Ef9SX8sVQX3RETHOihyKHc,36558
95
+ seleniumbase/plugins/driver_manager.py,sha256=NtnnCme2x5ZZT60w9EgZPZspBpO1tnoRBo_BMWN5Jrw,41775
92
96
  seleniumbase/plugins/page_source.py,sha256=mifv7Rkkb9qcrFY2H-9fctoR1CpHHiCgnFTOY2p7mBY,1889
93
- seleniumbase/plugins/pytest_plugin.py,sha256=G76W_gAOJgpeKqQnKlj8FCrbWnoi78LszSP71KZkTu8,109088
97
+ seleniumbase/plugins/pytest_plugin.py,sha256=st3Vo57NUhik6G4JB8SUU8xcdjFARP0NY5PXWb_Tf4o,114451
94
98
  seleniumbase/plugins/s3_logging_plugin.py,sha256=WDfertQgGOW_SRJpFMaekYD6vBVW9VO62POtXXy2HCM,2319
95
- seleniumbase/plugins/sb_manager.py,sha256=ulTDorccan06eVYtSqlX26EFKXmS0gCY0huJ67Q5gTY,58082
99
+ seleniumbase/plugins/sb_manager.py,sha256=zWCXCU594mL0FsQ9ZHb8sPkF3Ij6rKp2LDiFtTmjbE8,63405
96
100
  seleniumbase/plugins/screen_shots.py,sha256=1hrXw-hzuZ1BR6Yh7AyWX2ABnvnP73-RCbwdz958gj4,1127
97
- seleniumbase/plugins/selenium_plugin.py,sha256=M6opMlbU2-FjxOXzLJn6pHN_GDbNbvLpB-N5fvBEhuo,60252
101
+ seleniumbase/plugins/selenium_plugin.py,sha256=kL4avmksBmGh9n-PtfmEMei9Z8yr2vhoOCQgAsYcUDg,65990
98
102
  seleniumbase/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
103
  seleniumbase/translate/__init__.py,sha256=N2i5XntTwJZmwr9-qvdX5gC6Rdm5-ClIbnQ8yyPn4Oo,459
100
104
  seleniumbase/translate/chinese.py,sha256=0QhK2eadtsdN4KCvwki1J7jBCe8I4xxWbKzteJKJozY,24698
@@ -118,7 +122,7 @@ seleniumbase/undetected/webelement.py,sha256=OOpUYbEiOG52KsYYyuDW9tYLdA2SMnukvwQ
118
122
  seleniumbase/undetected/cdp_driver/__init__.py,sha256=Ga9alwuaZZy4_XOShc0HjgFnNqpPdrcbjAicz5gE7a4,215
119
123
  seleniumbase/undetected/cdp_driver/_contradict.py,sha256=lP4b0h5quAy573ETn_TBbYV889cL1AuPLVInpJ0ZkiU,3183
120
124
  seleniumbase/undetected/cdp_driver/browser.py,sha256=AQI6uWVyhv7VEnx0CE3V9MeoUa-VDilFPytnQile31Y,35651
121
- seleniumbase/undetected/cdp_driver/cdp_util.py,sha256=shNnA0IA0yASpQWsXh3P_ocidNAeqmkBFF_jMJ8YSvc,34215
125
+ seleniumbase/undetected/cdp_driver/cdp_util.py,sha256=wSgXxukwP4_-kVai0z1s1uoXYDiDab0jdBLa1HyW0nQ,34939
122
126
  seleniumbase/undetected/cdp_driver/config.py,sha256=B5Wf0E5xvCmIuLO_Y06oyKYd04yM2auj--JyGKUKsls,13630
123
127
  seleniumbase/undetected/cdp_driver/connection.py,sha256=FfGFXDyf_-JzvE2RRmT6Fi91I7Fsv8rLv91rPuX-6VY,25718
124
128
  seleniumbase/undetected/cdp_driver/element.py,sha256=FIC6v7OmumLCT-_vIc3H4oju_oBbaLpWJUJIKm2c_q4,40467
@@ -137,9 +141,9 @@ seleniumbase/utilities/selenium_grid/start-grid-hub.bat,sha256=Ftq-GrAKRYH2ssDPr
137
141
  seleniumbase/utilities/selenium_grid/start-grid-hub.sh,sha256=KADv0RUHONLL2_I443QFK8PryBpDmKn5Gy0s4o0vDSM,106
138
142
  seleniumbase/utilities/selenium_ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
143
  seleniumbase/utilities/selenium_ide/convert_ide.py,sha256=2tayFP_R9HGH0Xx6qYlPmArN0THntO6R0Wjo0qqgCZY,31680
140
- seleniumbase-4.43.2.dist-info/licenses/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
141
- seleniumbase-4.43.2.dist-info/METADATA,sha256=nMEs0AOuacDk8bVwLYnRXiPVzT2Af0RlEbXgMmfZ2_w,90312
142
- seleniumbase-4.43.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
- seleniumbase-4.43.2.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
- seleniumbase-4.43.2.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
- seleniumbase-4.43.2.dist-info/RECORD,,
144
+ seleniumbase-4.43.3.dist-info/licenses/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
145
+ seleniumbase-4.43.3.dist-info/METADATA,sha256=lvVpfGbWU7AtfcUFvhZMHQ-1pgtsnf1MDb6olvxwtHE,90492
146
+ seleniumbase-4.43.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
147
+ seleniumbase-4.43.3.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
148
+ seleniumbase-4.43.3.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
149
+ seleniumbase-4.43.3.dist-info/RECORD,,