seleniumbase 4.44.2__py3-none-any.whl → 4.45.10__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.
Files changed (42) hide show
  1. seleniumbase/__version__.py +1 -1
  2. seleniumbase/behave/behave_sb.py +14 -0
  3. seleniumbase/console_scripts/run.py +1 -0
  4. seleniumbase/console_scripts/sb_install.py +142 -11
  5. seleniumbase/console_scripts/sb_mkdir.py +76 -0
  6. seleniumbase/console_scripts/sb_mkrec.py +25 -0
  7. seleniumbase/console_scripts/sb_recorder.py +40 -3
  8. seleniumbase/core/browser_launcher.py +279 -117
  9. seleniumbase/core/detect_b_ver.py +8 -6
  10. seleniumbase/core/log_helper.py +11 -16
  11. seleniumbase/core/mysql.py +1 -1
  12. seleniumbase/core/report_helper.py +3 -7
  13. seleniumbase/core/sb_cdp.py +275 -78
  14. seleniumbase/core/sb_driver.py +36 -5
  15. seleniumbase/core/session_helper.py +2 -4
  16. seleniumbase/drivers/chromium_drivers/__init__.py +0 -0
  17. seleniumbase/fixtures/base_case.py +251 -201
  18. seleniumbase/fixtures/constants.py +1 -0
  19. seleniumbase/fixtures/js_utils.py +52 -14
  20. seleniumbase/fixtures/page_actions.py +18 -7
  21. seleniumbase/fixtures/page_utils.py +4 -2
  22. seleniumbase/fixtures/shared_utils.py +2 -4
  23. seleniumbase/masterqa/master_qa.py +16 -2
  24. seleniumbase/plugins/base_plugin.py +8 -0
  25. seleniumbase/plugins/driver_manager.py +15 -5
  26. seleniumbase/plugins/pytest_plugin.py +43 -57
  27. seleniumbase/plugins/sb_manager.py +23 -19
  28. seleniumbase/plugins/selenium_plugin.py +20 -13
  29. seleniumbase/undetected/__init__.py +11 -10
  30. seleniumbase/undetected/cdp.py +1 -12
  31. seleniumbase/undetected/cdp_driver/browser.py +330 -128
  32. seleniumbase/undetected/cdp_driver/cdp_util.py +48 -14
  33. seleniumbase/undetected/cdp_driver/config.py +78 -11
  34. seleniumbase/undetected/cdp_driver/connection.py +15 -43
  35. seleniumbase/undetected/cdp_driver/element.py +37 -22
  36. seleniumbase/undetected/cdp_driver/tab.py +414 -39
  37. {seleniumbase-4.44.2.dist-info → seleniumbase-4.45.10.dist-info}/METADATA +140 -152
  38. {seleniumbase-4.44.2.dist-info → seleniumbase-4.45.10.dist-info}/RECORD +42 -41
  39. {seleniumbase-4.44.2.dist-info → seleniumbase-4.45.10.dist-info}/licenses/LICENSE +1 -1
  40. {seleniumbase-4.44.2.dist-info → seleniumbase-4.45.10.dist-info}/WHEEL +0 -0
  41. {seleniumbase-4.44.2.dist-info → seleniumbase-4.45.10.dist-info}/entry_points.txt +0 -0
  42. {seleniumbase-4.44.2.dist-info → seleniumbase-4.45.10.dist-info}/top_level.txt +0 -0
@@ -360,18 +360,19 @@ def comet_on_windows_path(browser_type=None):
360
360
  for item in map(
361
361
  os.environ.get,
362
362
  (
363
+ "LOCALAPPDATA",
363
364
  "PROGRAMFILES",
364
365
  "PROGRAMFILES(X86)",
365
- "LOCALAPPDATA",
366
366
  "PROGRAMW6432",
367
367
  ),
368
368
  ):
369
369
  for subitem in (
370
+ "Perplexity/Comet/Application",
370
371
  "Comet/Application",
371
372
  "Programs/Comet",
372
373
  ):
373
374
  try:
374
- candidates.append(os.sep.join((item, subitem, "Comet.exe")))
375
+ candidates.append(os.sep.join((item, subitem, "comet.exe")))
375
376
  except TypeError:
376
377
  pass
377
378
  for candidate in candidates:
@@ -389,18 +390,19 @@ def atlas_on_windows_path(browser_type=None):
389
390
  for item in map(
390
391
  os.environ.get,
391
392
  (
393
+ "LOCALAPPDATA",
392
394
  "PROGRAMFILES",
393
395
  "PROGRAMFILES(X86)",
394
- "LOCALAPPDATA",
395
396
  "PROGRAMW6432",
396
397
  ),
397
398
  ):
398
399
  for subitem in (
400
+ "OpenAI/Atlas/Application",
399
401
  "Atlas/Application",
400
402
  "Programs/Atlas",
401
403
  ):
402
404
  try:
403
- candidates.append(os.sep.join((item, subitem, "Atlas.exe")))
405
+ candidates.append(os.sep.join((item, subitem, "atlas.exe")))
404
406
  except TypeError:
405
407
  pass
406
408
  for candidate in candidates:
@@ -460,8 +462,8 @@ def get_binary_location(browser_type, chromium_ok=False):
460
462
  },
461
463
  ChromeType.ATLAS: {
462
464
  OSType.LINUX: atlas_on_linux_path(browser_type),
463
- OSType.MAC: r"/Applications/Atlas.app"
464
- r"/Contents/MacOS/Atlas",
465
+ OSType.MAC: r"/Applications/ChatGPT Atlas.app"
466
+ r"/Contents/MacOS/ChatGPT Atlas",
465
467
  OSType.WIN: atlas_on_windows_path(browser_type),
466
468
  },
467
469
  }
@@ -25,7 +25,7 @@ def log_screenshot(test_logpath, driver, screenshot=None, get=False):
25
25
  screenshot_skipped = constants.Warnings.SCREENSHOT_SKIPPED
26
26
  screenshot_warning = constants.Warnings.SCREENSHOT_UNDEFINED
27
27
  if (
28
- (hasattr(sb_config, "no_screenshot") and sb_config.no_screenshot)
28
+ getattr(sb_config, "no_screenshot", None)
29
29
  or screenshot == screenshot_skipped
30
30
  ):
31
31
  if get:
@@ -186,14 +186,10 @@ def log_test_failure_data(test, test_logpath, driver, browser, url=None):
186
186
  data_to_save.append(
187
187
  "--------------------------------------------------------------------"
188
188
  )
189
- if (
190
- hasattr(test, "_outcome")
191
- and hasattr(test._outcome, "errors")
192
- and test._outcome.errors
193
- ):
189
+ if hasattr(test, "_outcome") and getattr(test._outcome, "errors", None):
194
190
  try:
195
- exc_message = test._outcome.errors[0][1][1]
196
- traceback_address = test._outcome.errors[0][1][2]
191
+ exc_message = test._outcome.errors[-1][1][1]
192
+ traceback_address = test._outcome.errors[-1][1][2]
197
193
  traceback_list = traceback.format_list(
198
194
  traceback.extract_tb(traceback_address)[1:]
199
195
  )
@@ -225,12 +221,11 @@ def log_test_failure_data(test, test_logpath, driver, browser, url=None):
225
221
  data_to_save.append("Exception: %s" % exc_message)
226
222
  else:
227
223
  traceback_message = None
228
- if hasattr(test, "is_behave") and test.is_behave:
224
+ if getattr(test, "is_behave", None):
229
225
  if sb_config.behave_scenario.status.name == "failed":
230
226
  if (
231
227
  hasattr(sb_config, "behave_step")
232
- and hasattr(sb_config.behave_step, "error_message")
233
- and sb_config.behave_step.error_message
228
+ and getattr(sb_config.behave_step, "error_message", None)
234
229
  ):
235
230
  traceback_message = sb_config.behave_step.error_message
236
231
  else:
@@ -262,7 +257,7 @@ def log_test_failure_data(test, test_logpath, driver, browser, url=None):
262
257
  )
263
258
  else:
264
259
  message = None
265
- if hasattr(test, "is_behave") and test.is_behave:
260
+ if getattr(test, "is_behave", None):
266
261
  message = "Behave step was not implemented or skipped!"
267
262
  else:
268
263
  message = "Traceback not found!"
@@ -281,7 +276,7 @@ def log_test_failure_data(test, test_logpath, driver, browser, url=None):
281
276
  data_to_save.append("Exception: %s" % sb_config._excinfo_value)
282
277
  else:
283
278
  data_to_save.append("Traceback:\n %s" % traceback_message)
284
- if hasattr(test, "is_nosetest") and test.is_nosetest:
279
+ if getattr(test, "is_nosetest", None):
285
280
  # Also save the data for the report
286
281
  sb_config._report_test_id = test_id
287
282
  sb_config._report_fail_page = last_page
@@ -394,7 +389,7 @@ def log_page_source(test_logpath, driver, source=None):
394
389
 
395
390
 
396
391
  def get_test_id(test):
397
- if hasattr(test, "is_behave") and test.is_behave:
392
+ if getattr(test, "is_behave", None):
398
393
  file_name = sb_config.behave_scenario.filename
399
394
  line_num = sb_config.behave_line_num
400
395
  scenario_name = sb_config.behave_scenario.name
@@ -402,7 +397,7 @@ def get_test_id(test):
402
397
  scenario_name = scenario_name.split(" -- @")[0]
403
398
  test_id = "%s:%s => %s" % (file_name, line_num, scenario_name)
404
399
  return test_id
405
- elif hasattr(test, "is_context_manager") and test.is_context_manager:
400
+ elif getattr(test, "is_context_manager", None):
406
401
  filename = test.__class__.__module__.split(".")[-1] + ".py"
407
402
  classname = test.__class__.__name__
408
403
  methodname = test._testMethodName
@@ -412,7 +407,7 @@ def get_test_id(test):
412
407
 
413
408
  stack_base = traceback.format_stack()[0].split(", in ")[0]
414
409
  test_base = stack_base.split(", in ")[0].split(os.sep)[-1]
415
- if hasattr(test, "cm_filename") and test.cm_filename:
410
+ if getattr(test, "cm_filename", None):
416
411
  filename = test.cm_filename
417
412
  else:
418
413
  filename = test_base.split('"')[0]
@@ -42,7 +42,7 @@ class DatabaseManager:
42
42
  db_user = settings.DB_USERNAME
43
43
  db_pass = settings.DB_PASSWORD
44
44
  db_schema = settings.DB_SCHEMA
45
- if hasattr(sb_config, "settings_file") and sb_config.settings_file:
45
+ if getattr(sb_config, "settings_file", None):
46
46
  override = settings_parser.set_settings(sb_config.settings_file)
47
47
  if "DB_HOST" in override.keys():
48
48
  db_server = override["DB_HOST"]
@@ -100,18 +100,14 @@ def process_failures(test, test_count, duration):
100
100
  bad_page_image = "failure_%s.png" % test_count
101
101
  bad_page_data = "failure_%s.txt" % test_count
102
102
  screenshot_path = os.path.join(LATEST_REPORT_DIR, bad_page_image)
103
- if hasattr(test, "_last_page_screenshot") and test._last_page_screenshot:
103
+ if getattr(test, "_last_page_screenshot", None):
104
104
  with open(screenshot_path, mode="wb") as file:
105
105
  file.write(test._last_page_screenshot)
106
106
  save_test_failure_data(test, bad_page_data, folder=LATEST_REPORT_DIR)
107
107
  exc_message = None
108
- if (
109
- hasattr(test, "_outcome")
110
- and hasattr(test._outcome, "errors")
111
- and test._outcome.errors
112
- ):
108
+ if hasattr(test, "_outcome") and getattr(test._outcome, "errors", None):
113
109
  try:
114
- exc_message = test._outcome.errors[0][1][1]
110
+ exc_message = test._outcome.errors[-1][1][1]
115
111
  except Exception:
116
112
  exc_message = "(Unknown Exception)"
117
113
  else: