seleniumbase 4.31.4__py3-none-any.whl → 4.31.6__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 (28) hide show
  1. seleniumbase/__init__.py +13 -6
  2. seleniumbase/__version__.py +1 -1
  3. seleniumbase/behave/behave_sb.py +0 -8
  4. seleniumbase/console_scripts/logo_helper.py +0 -8
  5. seleniumbase/console_scripts/run.py +344 -341
  6. seleniumbase/console_scripts/sb_behave_gui.py +0 -7
  7. seleniumbase/console_scripts/sb_caseplans.py +0 -7
  8. seleniumbase/console_scripts/sb_commander.py +0 -7
  9. seleniumbase/console_scripts/sb_install.py +47 -47
  10. seleniumbase/console_scripts/sb_mkchart.py +13 -20
  11. seleniumbase/console_scripts/sb_mkdir.py +9 -16
  12. seleniumbase/console_scripts/sb_mkfile.py +27 -34
  13. seleniumbase/console_scripts/sb_mkpres.py +13 -20
  14. seleniumbase/console_scripts/sb_mkrec.py +12 -19
  15. seleniumbase/console_scripts/sb_objectify.py +30 -30
  16. seleniumbase/console_scripts/sb_print.py +5 -12
  17. seleniumbase/console_scripts/sb_recorder.py +0 -7
  18. seleniumbase/fixtures/base_case.py +0 -4
  19. seleniumbase/fixtures/shared_utils.py +6 -0
  20. seleniumbase/plugins/pytest_plugin.py +0 -8
  21. seleniumbase/plugins/sb_manager.py +1 -6
  22. seleniumbase/translate/translator.py +0 -7
  23. {seleniumbase-4.31.4.dist-info → seleniumbase-4.31.6.dist-info}/METADATA +1 -1
  24. {seleniumbase-4.31.4.dist-info → seleniumbase-4.31.6.dist-info}/RECORD +28 -28
  25. {seleniumbase-4.31.4.dist-info → seleniumbase-4.31.6.dist-info}/LICENSE +0 -0
  26. {seleniumbase-4.31.4.dist-info → seleniumbase-4.31.6.dist-info}/WHEEL +0 -0
  27. {seleniumbase-4.31.4.dist-info → seleniumbase-4.31.6.dist-info}/entry_points.txt +0 -0
  28. {seleniumbase-4.31.4.dist-info → seleniumbase-4.31.6.dist-info}/top_level.txt +0 -0
@@ -38,13 +38,6 @@ def set_colors(use_colors):
38
38
  c6 = ""
39
39
  cr = ""
40
40
  if use_colors:
41
- if (
42
- shared_utils.is_windows()
43
- and hasattr(colorama, "just_fix_windows_console")
44
- ):
45
- colorama.just_fix_windows_console()
46
- else:
47
- colorama.init(autoreset=True)
48
41
  c0 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
49
42
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
50
43
  c2 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
@@ -42,13 +42,6 @@ def set_colors(use_colors):
42
42
  c5 = ""
43
43
  cr = ""
44
44
  if use_colors:
45
- if (
46
- shared_utils.is_windows()
47
- and hasattr(colorama, "just_fix_windows_console")
48
- ):
49
- colorama.just_fix_windows_console()
50
- else:
51
- colorama.init(autoreset=True)
52
45
  c0 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
53
46
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
54
47
  c2 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
@@ -42,13 +42,6 @@ def set_colors(use_colors):
42
42
  c5 = ""
43
43
  cr = ""
44
44
  if use_colors:
45
- if (
46
- shared_utils.is_windows()
47
- and hasattr(colorama, "just_fix_windows_console")
48
- ):
49
- colorama.just_fix_windows_console()
50
- else:
51
- colorama.init(autoreset=True)
52
45
  c0 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
53
46
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
54
47
  c2 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
@@ -2,28 +2,28 @@
2
2
  Downloads the specified webdriver to "seleniumbase/drivers/"
3
3
 
4
4
  Usage:
5
- sbase get {chromedriver|geckodriver|edgedriver|
6
- iedriver|uc_driver} [OPTIONS]
5
+ sbase get {chromedriver|geckodriver|edgedriver|
6
+ iedriver|uc_driver} [OPTIONS]
7
7
  Options:
8
- VERSION Specify the version.
9
- Tries to detect the needed version.
10
- If using chromedriver or edgedriver,
11
- you can use the major version integer.
12
- -p OR --path Also copy the driver to /usr/local/bin
8
+ VERSION Specify the version.
9
+ Tries to detect the needed version.
10
+ If using chromedriver or edgedriver,
11
+ you can use the major version integer.
12
+ -p OR --path Also copy the driver to /usr/local/bin
13
13
  Examples:
14
- sbase get chromedriver
15
- sbase get geckodriver
16
- sbase get edgedriver
17
- sbase get chromedriver 114
18
- sbase get chromedriver 114.0.5735.90
19
- sbase get chromedriver stable
20
- sbase get chromedriver beta
21
- sbase get chromedriver -p
14
+ sbase get chromedriver
15
+ sbase get geckodriver
16
+ sbase get edgedriver
17
+ sbase get chromedriver 114
18
+ sbase get chromedriver 114.0.5735.90
19
+ sbase get chromedriver stable
20
+ sbase get chromedriver beta
21
+ sbase get chromedriver -p
22
22
  Output:
23
- Downloads the webdriver to seleniumbase/drivers/
24
- (chromedriver is required for Chrome automation)
25
- (geckodriver is required for Firefox automation)
26
- (edgedriver is required for MS__Edge automation)
23
+ Downloads the webdriver to seleniumbase/drivers/
24
+ (chromedriver is required for Chrome automation)
25
+ (geckodriver is required for Firefox automation)
26
+ (edgedriver is required for MS__Edge automation)
27
27
  """
28
28
  import colorama
29
29
  import logging
@@ -57,32 +57,33 @@ DEFAULT_EDGEDRIVER_VERSION = "115.0.1901.183" # (If can't find LATEST_STABLE)
57
57
  def invalid_run_command():
58
58
  exp = " ** get / install **\n\n"
59
59
  exp += " Usage:\n"
60
- exp += " seleniumbase install [DRIVER] [OPTIONS]\n"
61
- exp += " OR sbase install [DRIVER] [OPTIONS]\n"
62
- exp += " OR seleniumbase get [DRIVER] [OPTIONS]\n"
63
- exp += " OR sbase get [DRIVER] [OPTIONS]\n"
64
- exp += " (Drivers: chromedriver, geckodriver, edgedriver,\n"
65
- exp += " iedriver, uc_driver)\n"
60
+ exp += " seleniumbase install [DRIVER_NAME] [OPTIONS]\n"
61
+ exp += " OR sbase install [DRIVER_NAME] [OPTIONS]\n"
62
+ exp += " OR seleniumbase get [DRIVER_NAME] [OPTIONS]\n"
63
+ exp += " OR sbase get [DRIVER_NAME] [OPTIONS]\n"
64
+ exp += " (Drivers: chromedriver, geckodriver,\n"
65
+ exp += " edgedriver, iedriver, uc_driver)\n"
66
66
  exp += " Options:\n"
67
- exp += " VERSION Specify the version.\n"
68
- exp += " Tries to detect the needed version.\n"
69
- exp += " If using chromedriver or edgedriver,\n"
70
- exp += " you can use the major version integer.\n"
71
- exp += " -p OR --path Also copy the driver to /usr/local/bin\n"
67
+ exp += " VERSION Specify the version.\n"
68
+ exp += " Tries to detect the needed version.\n"
69
+ exp += " If using chromedriver or edgedriver,\n"
70
+ exp += " you can use the major version integer.\n"
71
+ exp += "\n"
72
+ exp += " -p OR --path Also copy the driver to /usr/local/bin\n"
72
73
  exp += " Examples:\n"
73
- exp += " sbase get chromedriver\n"
74
- exp += " sbase get geckodriver\n"
75
- exp += " sbase get edgedriver\n"
76
- exp += " sbase get chromedriver 114\n"
77
- exp += " sbase get chromedriver 114.0.5735.90\n"
78
- exp += " sbase get chromedriver stable\n"
79
- exp += " sbase get chromedriver beta\n"
80
- exp += " sbase get chromedriver -p\n"
74
+ exp += " sbase get chromedriver\n"
75
+ exp += " sbase get geckodriver\n"
76
+ exp += " sbase get edgedriver\n"
77
+ exp += " sbase get chromedriver 114\n"
78
+ exp += " sbase get chromedriver 114.0.5735.90\n"
79
+ exp += " sbase get chromedriver stable\n"
80
+ exp += " sbase get chromedriver beta\n"
81
+ exp += " sbase get chromedriver -p\n"
81
82
  exp += " Output:\n"
82
- exp += " Downloads the webdriver to seleniumbase/drivers/\n"
83
- exp += " (chromedriver is required for Chrome automation)\n"
84
- exp += " (geckodriver is required for Firefox automation)\n"
85
- exp += " (edgedriver is required for MS__Edge automation)\n"
83
+ exp += " Downloads the webdriver to seleniumbase/drivers/\n"
84
+ exp += " (chromedriver is required for Chrome automation)\n"
85
+ exp += " (geckodriver is required for Firefox automation)\n"
86
+ exp += " (edgedriver is required for MS__Edge automation)\n"
86
87
  print("")
87
88
  raise Exception("%s\n\n%s" % (constants.Warnings.INVALID_RUN_COMMAND, exp))
88
89
 
@@ -293,10 +294,6 @@ def main(override=None, intel_for_uc=None, force_uc=None):
293
294
  use_version = ""
294
295
  new_file = ""
295
296
  f_name = ""
296
- if IS_WINDOWS and hasattr(colorama, "just_fix_windows_console"):
297
- colorama.just_fix_windows_console()
298
- else:
299
- colorama.init(autoreset=True)
300
297
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
301
298
  c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
302
299
  c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
@@ -944,7 +941,10 @@ def main(override=None, intel_for_uc=None, force_uc=None):
944
941
  f_name = "uc_driver"
945
942
  new_file = os.path.join(downloads_folder, str(f_name))
946
943
  pr_file = c3 + new_file + cr
947
- log_d("The file [%s] was saved to:\n%s\n" % (f_name, pr_file))
944
+ d_folder = os.sep.join(pr_file.split(os.sep)[:-1]) + os.sep
945
+ d_file = pr_file.split(os.sep)[-1]
946
+ d_ff = c3 + d_folder + cr + "\n" + c3 + d_file + cr
947
+ log_d("The file [%s] was saved to:\n%s\n" % (f_name, d_ff))
948
948
  log_d("Making [%s %s] executable ..." % (f_name, use_version))
949
949
  make_executable(new_file)
950
950
  log_d(
@@ -31,22 +31,22 @@ import sys
31
31
  def invalid_run_command(msg=None):
32
32
  exp = " ** mkchart **\n\n"
33
33
  exp += " Usage:\n"
34
- exp += " seleniumbase mkchart [FILE.py] [LANG]\n"
35
- exp += " OR sbase mkchart [FILE.py] [LANG]\n"
34
+ exp += " seleniumbase mkchart [FILE.py] [LANG]\n"
35
+ exp += " OR sbase mkchart [FILE.py] [LANG]\n"
36
36
  exp += " Example:\n"
37
- exp += " sbase mkchart new_chart.py --en\n"
37
+ exp += " sbase mkchart new_chart.py --en\n"
38
38
  exp += " Language Options:\n"
39
- exp += " --en / --English | --zh / --Chinese\n"
40
- exp += " --nl / --Dutch | --fr / --French\n"
41
- exp += " --it / --Italian | --ja / --Japanese\n"
42
- exp += " --ko / --Korean | --pt / --Portuguese\n"
43
- exp += " --ru / --Russian | --es / --Spanish\n"
39
+ exp += " --en / --English | --zh / --Chinese\n"
40
+ exp += " --nl / --Dutch | --fr / --French\n"
41
+ exp += " --it / --Italian | --ja / --Japanese\n"
42
+ exp += " --ko / --Korean | --pt / --Portuguese\n"
43
+ exp += " --ru / --Russian | --es / --Spanish\n"
44
44
  exp += " Output:\n"
45
- exp += " Creates a new SeleniumBase chart presentation.\n"
46
- exp += " If the file already exists, an error is raised.\n"
47
- exp += " By default, the slides are written in English,\n"
48
- exp += ' and use a "sky" theme with "slide" transition.\n'
49
- exp += " The chart can be used as a basic boilerplate.\n"
45
+ exp += " Creates a new SeleniumBase chart presentation.\n"
46
+ exp += " If the file already exists, an error is raised.\n"
47
+ exp += " By default, the slides are written in English,\n"
48
+ exp += ' and use a "sky" theme with "slide" transition.\n'
49
+ exp += " The chart can be used as a basic boilerplate.\n"
50
50
  if not msg:
51
51
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
52
52
  elif msg == "help":
@@ -62,13 +62,6 @@ def main():
62
62
  c7 = ""
63
63
  cr = ""
64
64
  if "linux" not in sys.platform:
65
- if (
66
- "win32" in sys.platform
67
- and hasattr(colorama, "just_fix_windows_console")
68
- ):
69
- colorama.just_fix_windows_console()
70
- else:
71
- colorama.init(autoreset=True)
72
65
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
73
66
  c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
74
67
  c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
@@ -27,18 +27,18 @@ import sys
27
27
  def invalid_run_command(msg=None):
28
28
  exp = " ** mkdir **\n\n"
29
29
  exp += " Usage:\n"
30
- exp += " seleniumbase mkdir [DIRECTORY] [OPTIONS]\n"
31
- exp += " OR sbase mkdir [DIRECTORY] [OPTIONS]\n"
30
+ exp += " seleniumbase mkdir [DIRECTORY] [OPTIONS]\n"
31
+ exp += " OR sbase mkdir [DIRECTORY] [OPTIONS]\n"
32
32
  exp += " Example:\n"
33
- exp += " sbase mkdir ui_tests\n"
33
+ exp += " sbase mkdir ui_tests\n"
34
34
  exp += " Options:\n"
35
- exp += " -b / --basic (Only config files. No tests added.)\n"
35
+ exp += " -b / --basic (Only config files. No tests added.)\n"
36
36
  exp += " Output:\n"
37
- exp += " Creates a new folder for running SBase scripts.\n"
38
- exp += " The new folder contains default config files,\n"
39
- exp += " sample tests for helping new users get started,\n"
40
- exp += " and Python boilerplates for setting up customized\n"
41
- exp += " test frameworks.\n"
37
+ exp += " Creates a new folder for running SBase scripts.\n"
38
+ exp += " The new folder contains default config files,\n"
39
+ exp += " sample tests for helping new users get started,\n"
40
+ exp += " and Python boilerplates for setting up customized\n"
41
+ exp += " test frameworks.\n"
42
42
  if not msg:
43
43
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
44
44
  elif msg == "help":
@@ -54,13 +54,6 @@ def main():
54
54
  c7 = ""
55
55
  cr = ""
56
56
  if "linux" not in sys.platform:
57
- if (
58
- "win32" in sys.platform
59
- and hasattr(colorama, "just_fix_windows_console")
60
- ):
61
- colorama.just_fix_windows_console()
62
- else:
63
- colorama.init(autoreset=True)
64
57
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
65
58
  c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
66
59
  c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
@@ -49,38 +49,38 @@ import sys
49
49
  def invalid_run_command(msg=None):
50
50
  exp = " ** mkfile **\n\n"
51
51
  exp += " Usage:\n"
52
- exp += " seleniumbase mkfile [FILE.py] [OPTIONS]\n"
53
- exp += " OR sbase mkfile [FILE.py] [OPTIONS]\n"
52
+ exp += " seleniumbase mkfile [FILE.py] [OPTIONS]\n"
53
+ exp += " OR sbase mkfile [FILE.py] [OPTIONS]\n"
54
54
  exp += " Example:\n"
55
- exp += " sbase mkfile new_test.py\n"
55
+ exp += " sbase mkfile new_test.py\n"
56
56
  exp += " Options:\n"
57
- exp += " --uc (UC Mode boilerplate using SB context manager)\n"
58
- exp += " -b / --basic (Basic boilerplate / single-line test)\n"
59
- exp += " -r / --rec (Adds Pdb+ breakpoint for Recorder Mode)\n"
60
- exp += " --url=URL (Makes the test start on a specific page)\n"
57
+ exp += " --uc (UC Mode boilerplate using SB context manager)\n"
58
+ exp += " -b / --basic (Basic boilerplate / single-line test)\n"
59
+ exp += " -r / --rec (Adds Pdb+ breakpoint for Recorder Mode)\n"
60
+ exp += " --url=URL (Makes the test start on a specific page)\n"
61
61
  exp += " Language Options:\n"
62
- exp += " --en / --English | --zh / --Chinese\n"
63
- exp += " --nl / --Dutch | --fr / --French\n"
64
- exp += " --it / --Italian | --ja / --Japanese\n"
65
- exp += " --ko / --Korean | --pt / --Portuguese\n"
66
- exp += " --ru / --Russian | --es / --Spanish\n"
62
+ exp += " --en / --English | --zh / --Chinese\n"
63
+ exp += " --nl / --Dutch | --fr / --French\n"
64
+ exp += " --it / --Italian | --ja / --Japanese\n"
65
+ exp += " --ko / --Korean | --pt / --Portuguese\n"
66
+ exp += " --ru / --Russian | --es / --Spanish\n"
67
67
  exp += " Syntax Formats:\n"
68
- exp += " --bc / --basecase (BaseCase class inheritance)\n"
69
- exp += " --pf / --pytest-fixture (sb pytest fixture)\n"
70
- exp += " --cf / --class-fixture (class + sb pytest fixture)\n"
71
- exp += " --cm / --context-manager (SB context manager)\n"
72
- exp += " --dc / --driver-context (DriverContext manager)\n"
73
- exp += " --dm / --driver-manager (Driver manager)\n"
68
+ exp += " --bc / --basecase (BaseCase class inheritance)\n"
69
+ exp += " --pf / --pytest-fixture (sb pytest fixture)\n"
70
+ exp += " --cf / --class-fixture (class + sb pytest fixture)\n"
71
+ exp += " --cm / --context-manager (SB context manager)\n"
72
+ exp += " --dc / --driver-context (DriverContext manager)\n"
73
+ exp += " --dm / --driver-manager (Driver manager)\n"
74
74
  exp += " Output:\n"
75
- exp += " Creates a new SBase test file with boilerplate code.\n"
76
- exp += " If the file already exists, an error is raised.\n"
77
- exp += " By default, uses English with BaseCase inheritance,\n"
78
- exp += " and creates a boilerplate with common SeleniumBase\n"
79
- exp += ' methods: "open", "type", "click", "assert_element",\n'
80
- exp += ' and "assert_text". If using the basic boilerplate\n'
81
- exp += ' option, only the "open" method is included. Only the\n'
82
- exp += " BaseCase format supports Languages or Recorder Mode.\n"
83
- exp += " UC Mode automatically uses English with SB() format.\n"
75
+ exp += " Creates a new SBase test file with boilerplate code.\n"
76
+ exp += " If the file already exists, an error is raised.\n"
77
+ exp += " By default, uses English with BaseCase inheritance,\n"
78
+ exp += " and creates a boilerplate with common SeleniumBase\n"
79
+ exp += ' methods: "open", "type", "click", "assert_element",\n'
80
+ exp += ' and "assert_text". If using the basic boilerplate\n'
81
+ exp += ' option, only the "open" method is included. Only the\n'
82
+ exp += " BaseCase format supports Languages or Recorder Mode.\n"
83
+ exp += " UC Mode automatically uses English with SB() format.\n"
84
84
  if not msg:
85
85
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
86
86
  elif msg == "help":
@@ -96,13 +96,6 @@ def main():
96
96
  c7 = ""
97
97
  cr = ""
98
98
  if "linux" not in sys.platform:
99
- if (
100
- "win32" in sys.platform
101
- and hasattr(colorama, "just_fix_windows_console")
102
- ):
103
- colorama.just_fix_windows_console()
104
- else:
105
- colorama.init(autoreset=True)
106
99
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
107
100
  c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
108
101
  c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
@@ -31,22 +31,22 @@ import sys
31
31
  def invalid_run_command(msg=None):
32
32
  exp = " ** mkpres **\n\n"
33
33
  exp += " Usage:\n"
34
- exp += " seleniumbase mkpres [FILE.py] [LANG]\n"
35
- exp += " OR sbase mkpres [FILE.py] [LANG]\n"
34
+ exp += " seleniumbase mkpres [FILE.py] [LANG]\n"
35
+ exp += " OR sbase mkpres [FILE.py] [LANG]\n"
36
36
  exp += " Example:\n"
37
- exp += " sbase mkpres new_presentation.py --en\n"
37
+ exp += " sbase mkpres new_presentation.py --en\n"
38
38
  exp += " Language Options:\n"
39
- exp += " --en / --English | --zh / --Chinese\n"
40
- exp += " --nl / --Dutch | --fr / --French\n"
41
- exp += " --it / --Italian | --ja / --Japanese\n"
42
- exp += " --ko / --Korean | --pt / --Portuguese\n"
43
- exp += " --ru / --Russian | --es / --Spanish\n"
39
+ exp += " --en / --English | --zh / --Chinese\n"
40
+ exp += " --nl / --Dutch | --fr / --French\n"
41
+ exp += " --it / --Italian | --ja / --Japanese\n"
42
+ exp += " --ko / --Korean | --pt / --Portuguese\n"
43
+ exp += " --ru / --Russian | --es / --Spanish\n"
44
44
  exp += " Output:\n"
45
- exp += " Creates a new presentation with 3 example slides.\n"
46
- exp += " If the file already exists, an error is raised.\n"
47
- exp += " By default, the slides are written in English,\n"
48
- exp += ' and use "serif" theme with "slide" transition.\n'
49
- exp += " The slides can be used as a basic boilerplate.\n"
45
+ exp += " Creates a new presentation with 3 example slides.\n"
46
+ exp += " If the file already exists, an error is raised.\n"
47
+ exp += " By default, the slides are written in English,\n"
48
+ exp += ' and use "serif" theme with "slide" transition.\n'
49
+ exp += " The slides can be used as a basic boilerplate.\n"
50
50
  if not msg:
51
51
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
52
52
  elif msg == "help":
@@ -62,13 +62,6 @@ def main():
62
62
  c7 = ""
63
63
  cr = ""
64
64
  if "linux" not in sys.platform:
65
- if (
66
- "win32" in sys.platform
67
- and hasattr(colorama, "just_fix_windows_console")
68
- ):
69
- colorama.just_fix_windows_console()
70
- else:
71
- colorama.init(autoreset=True)
72
65
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
73
66
  c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
74
67
  c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
@@ -39,21 +39,21 @@ import sys
39
39
  def invalid_run_command(msg=None):
40
40
  exp = " ** mkrec / record / codegen **\n\n"
41
41
  exp += " Usage:\n"
42
- exp += " seleniumbase mkrec [FILE.py]\n"
43
- exp += " OR: sbase mkrec [FILE.py]\n"
42
+ exp += " seleniumbase mkrec [FILE.py]\n"
43
+ exp += " OR: sbase mkrec [FILE.py]\n"
44
44
  exp += " Examples:\n"
45
- exp += " sbase mkrec new_test.py\n"
46
- exp += " sbase mkrec new_test.py --url=wikipedia.org\n"
45
+ exp += " sbase mkrec new_test.py\n"
46
+ exp += " sbase mkrec new_test.py --url=wikipedia.org\n"
47
47
  exp += " Options:\n"
48
- exp += " --url=URL (Sets the initial start page URL.)\n"
49
- exp += " --edge (Use Edge browser instead of Chrome.)\n"
50
- exp += " --gui / --headed (Use headed mode on Linux.)\n"
51
- exp += " --uc / --undetected (Use undetectable mode.)\n"
52
- exp += " --overwrite (Overwrite file when it exists.)\n"
53
- exp += " --behave (Also output Behave/Gherkin files.)\n"
48
+ exp += " --url=URL (Sets the initial start page URL.)\n"
49
+ exp += " --edge (Use Edge browser instead of Chrome.)\n"
50
+ exp += " --gui / --headed (Use headed mode on Linux.)\n"
51
+ exp += " --uc / --undetected (Use undetectable mode.)\n"
52
+ exp += " --overwrite (Overwrite file when it exists.)\n"
53
+ exp += " --behave (Also output Behave/Gherkin files.)\n"
54
54
  exp += " Output:\n"
55
- exp += " Creates a new SeleniumBase test using the Recorder.\n"
56
- exp += " If the filename already exists, an error is raised.\n"
55
+ exp += " Creates a new SeleniumBase test using the Recorder.\n"
56
+ exp += " If the filename already exists, an error is raised.\n"
57
57
  if not msg:
58
58
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
59
59
  elif msg == "help":
@@ -71,13 +71,6 @@ def set_colors(use_colors):
71
71
  c7 = ""
72
72
  cr = ""
73
73
  if use_colors:
74
- if (
75
- "win32" in sys.platform
76
- and hasattr(colorama, "just_fix_windows_console")
77
- ):
78
- colorama.just_fix_windows_console()
79
- else:
80
- colorama.init(autoreset=True)
81
74
  c0 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
82
75
  c1 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
83
76
  c2 = colorama.Fore.LIGHTRED_EX + colorama.Back.LIGHTYELLOW_EX
@@ -2,11 +2,11 @@
2
2
  Converts a SeleniumBase Python file into one that uses the Page Object Pattern.
3
3
 
4
4
  Usage:
5
- seleniumbase objectify [SELENIUMBASE_PYTHON_FILE].py
5
+ seleniumbase objectify [SELENIUMBASE_PYTHON_FILE].py
6
6
  Output:
7
- A modified version of the file where the selectors
8
- have been replaced with variable names defined in
9
- "page_objects.py", supporting the Page Object Pattern.
7
+ A modified version of the file where the selectors
8
+ have been replaced with variable names defined in
9
+ "page_objects.py", supporting the Page Object Pattern.
10
10
  """
11
11
  import codecs
12
12
  import os
@@ -35,57 +35,57 @@ def invalid_run_command(shell_command):
35
35
  def invalid_objectify_run_command():
36
36
  exp = " ** objectify **\n\n"
37
37
  exp += " Usage:\n"
38
- exp += " seleniumbase objectify [SELENIUMBASE_PYTHON_FILE]\n"
38
+ exp += " seleniumbase objectify [SELENIUMBASE_PYTHON_FILE]\n"
39
39
  exp += " Options:\n"
40
- exp += " -c, --comments (Add object selectors to the comments.)\n"
41
- exp += " (Default: No added comments.)\n"
40
+ exp += " -c, --comments (Add object selectors to the comments.)\n"
41
+ exp += " (Default: No added comments.)\n"
42
42
  exp += " Output:\n"
43
- exp += " Converts a SeleniumBase Python file into one that uses\n"
44
- exp += " the Page Object Pattern by converting page selectors\n"
45
- exp += ' into objects stored in a "page_objects.py" file that is\n'
46
- exp += " autogenerated and stored in the same folder as tests.\n"
47
- exp += ' (seleniumbase "objectify" has the same outcome as\n'
48
- exp += ' combining "extract-objects" with "inject-objects")\n'
43
+ exp += " Converts a SeleniumBase Python file into one that uses\n"
44
+ exp += " the Page Object Pattern by converting page selectors\n"
45
+ exp += ' into objects stored in a "page_objects.py" file that is\n'
46
+ exp += " autogenerated and stored in the same folder as tests.\n"
47
+ exp += ' (seleniumbase "objectify" has the same outcome as\n'
48
+ exp += ' combining "extract-objects" with "inject-objects")\n'
49
49
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
50
50
 
51
51
 
52
52
  def invalid_inject_objects_run_command():
53
53
  exp = " ** inject-objects **\n\n"
54
54
  exp += " Usage:\n"
55
- exp += " seleniumbase inject-objects [SELENIUMBASE_PYTHON_FILE]\n"
55
+ exp += " seleniumbase inject-objects [SELENIUMBASE_PYTHON_FILE]\n"
56
56
  exp += " Options:\n"
57
- exp += " -c, --comments (Add object selectors to the comments.)\n"
58
- exp += " (Default: No added comments.)\n"
57
+ exp += " -c, --comments (Add object selectors to the comments.)\n"
58
+ exp += " (Default: No added comments.)\n"
59
59
  exp += " Output:\n"
60
- exp += ' Takes the page objects found in the "page_objects.py"\n'
61
- exp += " file and uses those to replace matching selectors in\n"
62
- exp += " the selected seleniumbase Python file.\n"
60
+ exp += ' Takes the page objects found in the "page_objects.py"\n'
61
+ exp += " file and uses those to replace matching selectors in\n"
62
+ exp += " the selected seleniumbase Python file.\n"
63
63
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
64
64
 
65
65
 
66
66
  def invalid_extract_objects_run_command():
67
67
  exp = " ** extract-objects **\n\n"
68
68
  exp += " Usage:\n"
69
- exp += " seleniumbase extract-objects [SELENIUMBASE_PYTHON_FILE]\n"
69
+ exp += " seleniumbase extract-objects [SELENIUMBASE_PYTHON_FILE]\n"
70
70
  exp += " Output:\n"
71
- exp += " Creates page objects based on selectors found in a\n"
72
- exp += " seleniumbase Python file and saves those objects to the\n"
73
- exp += ' "page_objects.py" file in the same folder as the tests.\n'
71
+ exp += " Creates page objects based on selectors found in a\n"
72
+ exp += " seleniumbase Python file and saves those objects to the\n"
73
+ exp += ' "page_objects.py" file in the same folder as the tests.\n'
74
74
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
75
75
 
76
76
 
77
77
  def invalid_revert_objects_run_command():
78
78
  exp = " ** revert-objects **\n\n"
79
79
  exp += " Usage:\n"
80
- exp += " seleniumbase revert-objects [SELENIUMBASE_PYTHON_FILE]\n"
80
+ exp += " seleniumbase revert-objects [SELENIUMBASE_PYTHON_FILE]\n"
81
81
  exp += " Options:\n"
82
- exp += " -c, --comments (Keep existing comments for the lines.)\n"
83
- exp += " (Default: No comments are kept.)\n"
82
+ exp += " -c, --comments (Keep existing comments for the lines.)\n"
83
+ exp += " (Default: No comments are kept.)\n"
84
84
  exp += " Output:\n"
85
- exp += ' Reverts the changes made by "seleniumbase objectify" or\n'
86
- exp += ' "seleniumbase inject-objects" when run against a\n'
87
- exp += " seleniumbase Python file. Objects will get replaced by\n"
88
- exp += ' selectors stored in the "page_objects.py" file.\n'
85
+ exp += ' Reverts the changes made by "seleniumbase objectify" or\n'
86
+ exp += ' "seleniumbase inject-objects" when run against a\n'
87
+ exp += " seleniumbase Python file. Objects will get replaced by\n"
88
+ exp += ' selectors stored in the "page_objects.py" file.\n'
89
89
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
90
90
 
91
91
 
@@ -18,13 +18,13 @@ import sys
18
18
  def invalid_run_command(msg=None):
19
19
  exp = " ** print **\n\n"
20
20
  exp += " Usage:\n"
21
- exp += " seleniumbase print [FILE] [OPTIONS]\n"
22
- exp += " OR: sbase print [FILE] [OPTIONS]\n"
21
+ exp += " seleniumbase print [FILE] [OPTIONS]\n"
22
+ exp += " OR: sbase print [FILE] [OPTIONS]\n"
23
23
  exp += " Options:\n"
24
- exp += " -n (Add line Numbers to the rows)\n"
24
+ exp += " -n (Add line Numbers to the rows)\n"
25
25
  exp += " Output:\n"
26
- exp += " Prints the code/text of any file\n"
27
- exp += " with syntax-highlighting.\n"
26
+ exp += " Prints the code/text of any file\n"
27
+ exp += " with syntax-highlighting.\n"
28
28
  if not msg:
29
29
  raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
30
30
  else:
@@ -61,13 +61,6 @@ def get_width(line):
61
61
 
62
62
 
63
63
  def main():
64
- if (
65
- "win32" in sys.platform
66
- and hasattr(colorama, "just_fix_windows_console")
67
- ):
68
- colorama.just_fix_windows_console()
69
- else:
70
- colorama.init(autoreset=True)
71
64
  c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
72
65
  c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
73
66
  cr = colorama.Style.RESET_ALL
@@ -45,13 +45,6 @@ def set_colors(use_colors):
45
45
  c4 = ""
46
46
  cr = ""
47
47
  if use_colors:
48
- if (
49
- "win32" in sys.platform
50
- and hasattr(colorama, "just_fix_windows_console")
51
- ):
52
- colorama.just_fix_windows_console()
53
- else:
54
- colorama.init(autoreset=True)
55
48
  c0 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
56
49
  c1 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
57
50
  c2 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
@@ -16112,8 +16112,6 @@ class BaseCase(unittest.TestCase):
16112
16112
  if is_windows:
16113
16113
  c1 = colorama.Fore.RED + colorama.Back.LIGHTRED_EX
16114
16114
  cr = colorama.Style.RESET_ALL
16115
- if hasattr(colorama, "just_fix_windows_console"):
16116
- colorama.just_fix_windows_console()
16117
16115
  msg = msg.replace("❌", c1 + "><" + cr)
16118
16116
  print(msg)
16119
16117
  else:
@@ -16121,8 +16119,6 @@ class BaseCase(unittest.TestCase):
16121
16119
  if is_windows:
16122
16120
  c2 = colorama.Fore.GREEN + colorama.Back.LIGHTGREEN_EX
16123
16121
  cr = colorama.Style.RESET_ALL
16124
- if hasattr(colorama, "just_fix_windows_console"):
16125
- colorama.just_fix_windows_console()
16126
16122
  msg = msg.replace("✅", c2 + "<>" + cr)
16127
16123
  print(msg)
16128
16124
  if self.dashboard:
@@ -1,4 +1,5 @@
1
1
  """Shared utility methods"""
2
+ import colorama
2
3
  import os
3
4
  import platform
4
5
  import sys
@@ -67,6 +68,11 @@ def get_terminal_width():
67
68
  return width
68
69
 
69
70
 
71
+ def fix_colorama_if_windows():
72
+ if is_windows():
73
+ colorama.just_fix_windows_console()
74
+
75
+
70
76
  def format_exc(exception, message):
71
77
  """Formats an exception message to make the output cleaner."""
72
78
  from selenium.common.exceptions import ElementNotVisibleException