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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. sbase/__init__.py +1 -0
  2. seleniumbase/__init__.py +2 -3
  3. seleniumbase/__version__.py +1 -1
  4. seleniumbase/behave/behave_sb.py +59 -11
  5. seleniumbase/config/settings.py +4 -0
  6. seleniumbase/console_scripts/logo_helper.py +47 -0
  7. seleniumbase/console_scripts/run.py +7 -4
  8. seleniumbase/console_scripts/sb_behave_gui.py +5 -5
  9. seleniumbase/console_scripts/sb_caseplans.py +6 -6
  10. seleniumbase/console_scripts/sb_commander.py +5 -5
  11. seleniumbase/console_scripts/sb_install.py +10 -2
  12. seleniumbase/console_scripts/sb_recorder.py +4 -4
  13. seleniumbase/core/browser_launcher.py +179 -108
  14. seleniumbase/core/mysql.py +1 -4
  15. seleniumbase/core/recorder_helper.py +24 -5
  16. seleniumbase/core/sb_driver.py +13 -3
  17. seleniumbase/core/settings_parser.py +4 -0
  18. seleniumbase/fixtures/base_case.py +324 -493
  19. seleniumbase/fixtures/js_utils.py +19 -52
  20. seleniumbase/fixtures/page_actions.py +3 -6
  21. seleniumbase/fixtures/page_utils.py +18 -53
  22. seleniumbase/plugins/base_plugin.py +2 -3
  23. seleniumbase/plugins/driver_manager.py +182 -5
  24. seleniumbase/plugins/pytest_plugin.py +51 -23
  25. seleniumbase/plugins/sb_manager.py +185 -5
  26. seleniumbase/plugins/selenium_plugin.py +71 -8
  27. seleniumbase/undetected/__init__.py +13 -38
  28. seleniumbase/undetected/dprocess.py +4 -6
  29. seleniumbase/undetected/options.py +3 -6
  30. seleniumbase/undetected/patcher.py +2 -3
  31. {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/METADATA +111 -125
  32. {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/RECORD +36 -47
  33. {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/WHEEL +1 -1
  34. sbase/ReadMe.txt +0 -2
  35. seleniumbase/ReadMe.md +0 -25
  36. seleniumbase/common/ReadMe.md +0 -71
  37. seleniumbase/console_scripts/ReadMe.md +0 -734
  38. seleniumbase/drivers/ReadMe.md +0 -27
  39. seleniumbase/extensions/ReadMe.md +0 -12
  40. seleniumbase/masterqa/ReadMe.md +0 -61
  41. seleniumbase/resources/ReadMe.md +0 -31
  42. seleniumbase/resources/favicon.ico +0 -0
  43. seleniumbase/utilities/selenium_grid/ReadMe.md +0 -84
  44. seleniumbase/utilities/selenium_ide/ReadMe.md +0 -111
  45. {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/LICENSE +0 -0
  46. {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/entry_points.txt +0 -0
  47. {seleniumbase-4.30.8.dist-info → seleniumbase-4.31.1.dist-info}/top_level.txt +0 -0
@@ -35,10 +35,7 @@ class DatabaseManager:
35
35
  import cryptography # noqa: F401
36
36
  import pymysql
37
37
  except Exception:
38
- if sys.version_info < (3, 7):
39
- shared_utils.pip_install("PyMySQL[rsa]", version="1.0.2")
40
- else:
41
- shared_utils.pip_install("PyMySQL[rsa]", version="1.1.0")
38
+ shared_utils.pip_install("PyMySQL[rsa]", version="1.1.1")
42
39
  import pymysql
43
40
  db_server = settings.DB_HOST
44
41
  db_port = settings.DB_PORT
@@ -422,9 +422,14 @@ def generate_sbase_code(srt_actions):
422
422
  ):
423
423
  import unicodedata
424
424
 
425
- action[1][0] = unicodedata.normalize("NFKC", action[1][0])
426
- action[1][0] = action[1][0].replace("\n", "\\n")
427
- action[1][0] = action[1][0].replace("\u00B6", "")
425
+ text_list = False
426
+ try:
427
+ action[1][0] = unicodedata.normalize("NFKC", action[1][0])
428
+ action[1][0] = action[1][0].replace("\n", "\\n")
429
+ action[1][0] = action[1][0].replace("\u00B6", "")
430
+ except Exception:
431
+ text_list = True
432
+
428
433
  method = "assert_text"
429
434
  if action[0] == "as_et":
430
435
  method = "assert_exact_text"
@@ -437,7 +442,17 @@ def generate_sbase_code(srt_actions):
437
442
  elif action[0] == "da_et":
438
443
  method = "deferred_assert_exact_text"
439
444
  if action[1][1] != "html":
440
- if '"' not in action[1][0] and '"' not in action[1][1]:
445
+ if text_list and '"' not in action[1][1]:
446
+ sb_actions.append(
447
+ 'self.%s(%s, "%s")'
448
+ % (method, action[1][0], action[1][1])
449
+ )
450
+ elif text_list and "'" not in action[1][1]:
451
+ sb_actions.append(
452
+ "self.%s(%s, '%s')"
453
+ % (method, action[1][0], action[1][1])
454
+ )
455
+ elif '"' not in action[1][0] and '"' not in action[1][1]:
441
456
  sb_actions.append(
442
457
  'self.%s("%s", "%s")'
443
458
  % (method, action[1][0], action[1][1])
@@ -458,7 +473,11 @@ def generate_sbase_code(srt_actions):
458
473
  % (method, action[1][0], action[1][1])
459
474
  )
460
475
  else:
461
- if '"' not in action[1][0]:
476
+ if text_list:
477
+ sb_actions.append(
478
+ 'self.%s(%s)' % (method, action[1][0])
479
+ )
480
+ elif '"' not in action[1][0]:
462
481
  sb_actions.append(
463
482
  'self.%s("%s")' % (method, action[1][0])
464
483
  )
@@ -1,4 +1,5 @@
1
1
  """Add new methods to extend the driver"""
2
+ from contextlib import suppress
2
3
  from selenium.webdriver.remote.webelement import WebElement
3
4
  from seleniumbase.fixtures import js_utils
4
5
  from seleniumbase.fixtures import page_actions
@@ -36,10 +37,8 @@ class DriverMethods():
36
37
  selector, by = page_utils.swap_selector_and_by_if_reversed(
37
38
  selector, by
38
39
  )
39
- try:
40
+ with suppress(Exception):
40
41
  return self.driver.default_find_element(by=by, value=selector)
41
- except Exception:
42
- pass
43
42
  raise Exception('No such Element: {%s} (by="%s")!' % (selector, by))
44
43
 
45
44
  def get_attribute(self, selector, attribute, by="css selector"):
@@ -162,6 +161,17 @@ class DriverMethods():
162
161
  self.driver, *args, **kwargs
163
162
  )
164
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
+
165
175
  def is_online(self):
166
176
  return self.driver.execute_script("return navigator.onLine;")
167
177
 
@@ -113,6 +113,10 @@ def set_settings(settings_file):
113
113
  settings.RAISE_INVALID_PROXY_STRING_EXCEPTION = override_settings[
114
114
  key
115
115
  ]
116
+ elif key == "WINDOW_START_X":
117
+ settings.WINDOW_START_X = override_settings[key]
118
+ elif key == "WINDOW_START_Y":
119
+ settings.WINDOW_START_Y = override_settings[key]
116
120
  elif key == "CHROME_START_WIDTH":
117
121
  settings.CHROME_START_WIDTH = override_settings[key]
118
122
  elif key == "CHROME_START_HEIGHT":