seleniumbase 4.24.10__py3-none-any.whl → 4.33.15__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.
- sbase/__init__.py +1 -0
- sbase/steps.py +7 -0
- seleniumbase/__init__.py +16 -7
- seleniumbase/__version__.py +1 -1
- seleniumbase/behave/behave_sb.py +97 -32
- seleniumbase/common/decorators.py +16 -7
- seleniumbase/config/proxy_list.py +3 -3
- seleniumbase/config/settings.py +4 -0
- seleniumbase/console_scripts/logo_helper.py +47 -8
- seleniumbase/console_scripts/run.py +345 -335
- seleniumbase/console_scripts/sb_behave_gui.py +5 -12
- seleniumbase/console_scripts/sb_caseplans.py +6 -13
- seleniumbase/console_scripts/sb_commander.py +5 -12
- seleniumbase/console_scripts/sb_install.py +62 -54
- seleniumbase/console_scripts/sb_mkchart.py +13 -20
- seleniumbase/console_scripts/sb_mkdir.py +11 -17
- seleniumbase/console_scripts/sb_mkfile.py +69 -43
- seleniumbase/console_scripts/sb_mkpres.py +13 -20
- seleniumbase/console_scripts/sb_mkrec.py +88 -21
- seleniumbase/console_scripts/sb_objectify.py +30 -30
- seleniumbase/console_scripts/sb_print.py +5 -12
- seleniumbase/console_scripts/sb_recorder.py +16 -11
- seleniumbase/core/browser_launcher.py +1658 -221
- seleniumbase/core/detect_b_ver.py +7 -8
- seleniumbase/core/log_helper.py +42 -27
- seleniumbase/core/mysql.py +1 -4
- seleniumbase/core/proxy_helper.py +35 -30
- seleniumbase/core/recorder_helper.py +24 -5
- seleniumbase/core/sb_cdp.py +1951 -0
- seleniumbase/core/sb_driver.py +162 -8
- seleniumbase/core/settings_parser.py +6 -0
- seleniumbase/core/style_sheet.py +10 -0
- seleniumbase/extensions/recorder.zip +0 -0
- seleniumbase/fixtures/base_case.py +1234 -632
- seleniumbase/fixtures/constants.py +10 -1
- seleniumbase/fixtures/js_utils.py +171 -144
- seleniumbase/fixtures/page_actions.py +177 -13
- seleniumbase/fixtures/page_utils.py +25 -53
- seleniumbase/fixtures/shared_utils.py +97 -11
- seleniumbase/js_code/active_css_js.py +1 -1
- seleniumbase/js_code/recorder_js.py +1 -1
- seleniumbase/plugins/base_plugin.py +2 -3
- seleniumbase/plugins/driver_manager.py +340 -65
- seleniumbase/plugins/pytest_plugin.py +276 -47
- seleniumbase/plugins/sb_manager.py +412 -99
- seleniumbase/plugins/selenium_plugin.py +122 -17
- seleniumbase/translate/translator.py +0 -7
- seleniumbase/undetected/__init__.py +59 -52
- seleniumbase/undetected/cdp.py +0 -1
- seleniumbase/undetected/cdp_driver/__init__.py +1 -0
- seleniumbase/undetected/cdp_driver/_contradict.py +110 -0
- seleniumbase/undetected/cdp_driver/browser.py +829 -0
- seleniumbase/undetected/cdp_driver/cdp_util.py +458 -0
- seleniumbase/undetected/cdp_driver/config.py +334 -0
- seleniumbase/undetected/cdp_driver/connection.py +639 -0
- seleniumbase/undetected/cdp_driver/element.py +1168 -0
- seleniumbase/undetected/cdp_driver/tab.py +1323 -0
- seleniumbase/undetected/dprocess.py +4 -7
- seleniumbase/undetected/options.py +6 -8
- seleniumbase/undetected/patcher.py +11 -13
- seleniumbase/undetected/reactor.py +0 -1
- seleniumbase/undetected/webelement.py +16 -3
- {seleniumbase-4.24.10.dist-info → seleniumbase-4.33.15.dist-info}/LICENSE +1 -1
- {seleniumbase-4.24.10.dist-info → seleniumbase-4.33.15.dist-info}/METADATA +299 -252
- {seleniumbase-4.24.10.dist-info → seleniumbase-4.33.15.dist-info}/RECORD +68 -70
- {seleniumbase-4.24.10.dist-info → seleniumbase-4.33.15.dist-info}/WHEEL +1 -1
- sbase/ReadMe.txt +0 -2
- seleniumbase/ReadMe.md +0 -25
- seleniumbase/common/ReadMe.md +0 -71
- seleniumbase/console_scripts/ReadMe.md +0 -731
- seleniumbase/drivers/ReadMe.md +0 -27
- seleniumbase/extensions/ReadMe.md +0 -12
- seleniumbase/masterqa/ReadMe.md +0 -61
- seleniumbase/resources/ReadMe.md +0 -31
- seleniumbase/resources/favicon.ico +0 -0
- seleniumbase/utilities/selenium_grid/ReadMe.md +0 -84
- seleniumbase/utilities/selenium_ide/ReadMe.md +0 -111
- {seleniumbase-4.24.10.dist-info → seleniumbase-4.33.15.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.24.10.dist-info → seleniumbase-4.33.15.dist-info}/top_level.txt +0 -0
@@ -16,16 +16,16 @@ Output:
|
|
16
16
|
import colorama
|
17
17
|
import subprocess
|
18
18
|
import sys
|
19
|
+
import tkinter as tk
|
20
|
+
from seleniumbase.fixtures import shared_utils
|
21
|
+
from tkinter.scrolledtext import ScrolledText
|
19
22
|
|
20
|
-
if sys.version_info <= (3,
|
23
|
+
if sys.version_info <= (3, 8):
|
21
24
|
current_version = ".".join(str(ver) for ver in sys.version_info[:3])
|
22
25
|
raise Exception(
|
23
|
-
"\n* SBase Commander requires Python 3.
|
26
|
+
"\n* SBase Commander requires Python 3.8 or newer!"
|
24
27
|
"\n** You are currently using Python %s" % current_version
|
25
28
|
)
|
26
|
-
from seleniumbase.fixtures import shared_utils
|
27
|
-
import tkinter as tk # noqa: E402
|
28
|
-
from tkinter.scrolledtext import ScrolledText # noqa: E402
|
29
29
|
|
30
30
|
|
31
31
|
def set_colors(use_colors):
|
@@ -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
|
@@ -20,17 +20,17 @@ import colorama
|
|
20
20
|
import os
|
21
21
|
import subprocess
|
22
22
|
import sys
|
23
|
+
import tkinter as tk
|
24
|
+
from seleniumbase.fixtures import shared_utils
|
25
|
+
from tkinter import messagebox
|
26
|
+
from tkinter.scrolledtext import ScrolledText
|
23
27
|
|
24
|
-
if sys.version_info <= (3,
|
28
|
+
if sys.version_info <= (3, 8):
|
25
29
|
current_version = ".".join(str(ver) for ver in sys.version_info[:3])
|
26
30
|
raise Exception(
|
27
|
-
"\n* SBase Case Plans Generator requires Python 3.
|
31
|
+
"\n* SBase Case Plans Generator requires Python 3.8 or newer!"
|
28
32
|
"\n** You are currently using Python %s" % current_version
|
29
33
|
)
|
30
|
-
from seleniumbase.fixtures import shared_utils
|
31
|
-
import tkinter as tk # noqa: E402
|
32
|
-
from tkinter import messagebox # noqa: E402
|
33
|
-
from tkinter.scrolledtext import ScrolledText # noqa: E402
|
34
34
|
|
35
35
|
|
36
36
|
def set_colors(use_colors):
|
@@ -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
|
@@ -21,16 +21,16 @@ import colorama
|
|
21
21
|
import os
|
22
22
|
import subprocess
|
23
23
|
import sys
|
24
|
+
import tkinter as tk
|
25
|
+
from seleniumbase.fixtures import shared_utils
|
26
|
+
from tkinter.scrolledtext import ScrolledText
|
24
27
|
|
25
|
-
if sys.version_info <= (3,
|
28
|
+
if sys.version_info <= (3, 8):
|
26
29
|
current_version = ".".join(str(ver) for ver in sys.version_info[:3])
|
27
30
|
raise Exception(
|
28
|
-
"\n* SBase Commander requires Python 3.
|
31
|
+
"\n* SBase Commander requires Python 3.8 or newer!"
|
29
32
|
"\n** You are currently using Python %s" % current_version
|
30
33
|
)
|
31
|
-
from seleniumbase.fixtures import shared_utils
|
32
|
-
import tkinter as tk # noqa: E402
|
33
|
-
from tkinter.scrolledtext import ScrolledText # noqa: E402
|
34
34
|
|
35
35
|
|
36
36
|
def set_colors(use_colors):
|
@@ -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
|
-
|
6
|
-
|
5
|
+
sbase get {chromedriver|geckodriver|edgedriver|
|
6
|
+
iedriver|uc_driver} [OPTIONS]
|
7
7
|
Options:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
@@ -50,39 +50,40 @@ IS_WINDOWS = shared_utils.is_windows()
|
|
50
50
|
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
|
51
51
|
LOCAL_PATH = "/usr/local/bin/" # On Mac and Linux systems
|
52
52
|
DEFAULT_CHROMEDRIVER_VERSION = "114.0.5735.90" # (If can't find LATEST_STABLE)
|
53
|
-
DEFAULT_GECKODRIVER_VERSION = "v0.
|
53
|
+
DEFAULT_GECKODRIVER_VERSION = "v0.35.0"
|
54
54
|
DEFAULT_EDGEDRIVER_VERSION = "115.0.1901.183" # (If can't find LATEST_STABLE)
|
55
55
|
|
56
56
|
|
57
57
|
def invalid_run_command():
|
58
58
|
exp = " ** get / install **\n\n"
|
59
59
|
exp += " Usage:\n"
|
60
|
-
exp += "
|
61
|
-
exp += "
|
62
|
-
exp += "
|
63
|
-
exp += "
|
64
|
-
exp += "
|
65
|
-
exp += "
|
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 += "
|
68
|
-
exp += "
|
69
|
-
exp += "
|
70
|
-
exp += "
|
71
|
-
exp += "
|
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 += "
|
74
|
-
exp += "
|
75
|
-
exp += "
|
76
|
-
exp += "
|
77
|
-
exp += "
|
78
|
-
exp += "
|
79
|
-
exp += "
|
80
|
-
exp += "
|
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 += "
|
83
|
-
exp += "
|
84
|
-
exp += "
|
85
|
-
exp += "
|
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
|
@@ -578,10 +575,18 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
578
575
|
else:
|
579
576
|
invalid_run_command()
|
580
577
|
if IS_MAC:
|
581
|
-
|
578
|
+
if IS_ARM_MAC:
|
579
|
+
file_name = "geckodriver-%s-macos-aarch64.tar.gz" % use_version
|
580
|
+
else:
|
581
|
+
file_name = "geckodriver-%s-macos.tar.gz" % use_version
|
582
582
|
elif IS_LINUX:
|
583
583
|
if "64" in ARCH:
|
584
|
-
|
584
|
+
if "aarch64" in platform.processor():
|
585
|
+
file_name = (
|
586
|
+
"geckodriver-%s-linux-aarch64.tar.gz" % use_version
|
587
|
+
)
|
588
|
+
else:
|
589
|
+
file_name = "geckodriver-%s-linux64.tar.gz" % use_version
|
585
590
|
else:
|
586
591
|
file_name = "geckodriver-%s-linux32.tar.gz" % use_version
|
587
592
|
elif IS_WINDOWS:
|
@@ -806,7 +811,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
806
811
|
zip_ref.extractall(downloads_folder)
|
807
812
|
zip_ref.close()
|
808
813
|
os.remove(zip_file_path)
|
809
|
-
shutil.
|
814
|
+
shutil.copy3(driver_path, os.path.join(downloads_folder, filename))
|
810
815
|
log_d("%sUnzip Complete!%s\n" % (c2, cr))
|
811
816
|
to_remove = [
|
812
817
|
"%s/%s/ruby_example/Gemfile" % (downloads_folder, h_ie_fn),
|
@@ -936,7 +941,10 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
936
941
|
f_name = "uc_driver"
|
937
942
|
new_file = os.path.join(downloads_folder, str(f_name))
|
938
943
|
pr_file = c3 + new_file + cr
|
939
|
-
|
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))
|
940
948
|
log_d("Making [%s %s] executable ..." % (f_name, use_version))
|
941
949
|
make_executable(new_file)
|
942
950
|
log_d(
|
@@ -945,7 +953,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
945
953
|
)
|
946
954
|
if copy_to_path and os.path.exists(LOCAL_PATH):
|
947
955
|
path_file = LOCAL_PATH + f_name
|
948
|
-
shutil.
|
956
|
+
shutil.copy2(new_file, path_file)
|
949
957
|
make_executable(path_file)
|
950
958
|
log_d("Also copied to: %s%s%s" % (c3, path_file, cr))
|
951
959
|
log_d("")
|
@@ -1034,7 +1042,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
1034
1042
|
)
|
1035
1043
|
if copy_to_path and os.path.exists(LOCAL_PATH):
|
1036
1044
|
path_file = LOCAL_PATH + f_name
|
1037
|
-
shutil.
|
1045
|
+
shutil.copy2(new_file, path_file)
|
1038
1046
|
make_executable(path_file)
|
1039
1047
|
log_d("Also copied to: %s%s%s" % (c3, path_file, cr))
|
1040
1048
|
log_d("")
|
@@ -1070,7 +1078,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
1070
1078
|
)
|
1071
1079
|
if copy_to_path and os.path.exists(LOCAL_PATH):
|
1072
1080
|
path_file = LOCAL_PATH + f_name
|
1073
|
-
shutil.
|
1081
|
+
shutil.copy2(new_file, path_file)
|
1074
1082
|
make_executable(path_file)
|
1075
1083
|
log_d("Also copied to: %s%s%s" % (c3, path_file, cr))
|
1076
1084
|
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 += "
|
35
|
-
exp += "
|
34
|
+
exp += " seleniumbase mkchart [FILE.py] [LANG]\n"
|
35
|
+
exp += " OR sbase mkchart [FILE.py] [LANG]\n"
|
36
36
|
exp += " Example:\n"
|
37
|
-
exp += "
|
37
|
+
exp += " sbase mkchart new_chart.py --en\n"
|
38
38
|
exp += " Language Options:\n"
|
39
|
-
exp += "
|
40
|
-
exp += "
|
41
|
-
exp += "
|
42
|
-
exp += "
|
43
|
-
exp += "
|
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 += "
|
46
|
-
exp += "
|
47
|
-
exp += "
|
48
|
-
exp += '
|
49
|
-
exp += "
|
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 += "
|
31
|
-
exp += "
|
30
|
+
exp += " seleniumbase mkdir [DIRECTORY] [OPTIONS]\n"
|
31
|
+
exp += " OR sbase mkdir [DIRECTORY] [OPTIONS]\n"
|
32
32
|
exp += " Example:\n"
|
33
|
-
exp += "
|
33
|
+
exp += " sbase mkdir ui_tests\n"
|
34
34
|
exp += " Options:\n"
|
35
|
-
exp += "
|
35
|
+
exp += " -b / --basic (Only config files. No tests added.)\n"
|
36
36
|
exp += " Output:\n"
|
37
|
-
exp += "
|
38
|
-
exp += "
|
39
|
-
exp += "
|
40
|
-
exp += "
|
41
|
-
exp += "
|
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
|
@@ -127,7 +120,7 @@ def main():
|
|
127
120
|
|
128
121
|
data = []
|
129
122
|
data.append("[pytest]")
|
130
|
-
data.append("addopts = --capture=
|
123
|
+
data.append("addopts = --capture=tee-sys -p no:cacheprovider")
|
131
124
|
data.append("norecursedirs = .* build dist recordings temp assets")
|
132
125
|
data.append("filterwarnings =")
|
133
126
|
data.append(" ignore::pytest.PytestWarning")
|
@@ -266,6 +259,7 @@ def main():
|
|
266
259
|
data.append("report_archives")
|
267
260
|
data.append("archived_reports")
|
268
261
|
data.append("html_report.html")
|
262
|
+
data.append("last_report.html")
|
269
263
|
data.append("report.html")
|
270
264
|
data.append("report.xml")
|
271
265
|
data.append("dashboard.html")
|
@@ -9,9 +9,10 @@ Example:
|
|
9
9
|
sbase mkfile new_test.py
|
10
10
|
|
11
11
|
Options:
|
12
|
+
--uc (UC Mode boilerplate using SB context manager)
|
12
13
|
-b / --basic (Basic boilerplate / single-line test)
|
13
|
-
-r / --rec (
|
14
|
-
--url=URL (
|
14
|
+
-r / --rec (Adds Pdb+ breakpoint for Recorder Mode)
|
15
|
+
--url=URL (Makes the test start on a specific page)
|
15
16
|
|
16
17
|
Language Options:
|
17
18
|
--en / --English | --zh / --Chinese
|
@@ -37,6 +38,7 @@ Output:
|
|
37
38
|
and "assert_text". If using the basic boilerplate
|
38
39
|
option, only the "open" method is included. Only the
|
39
40
|
BaseCase format supports Languages or Recorder Mode.
|
41
|
+
UC Mode automatically uses English with SB() format.
|
40
42
|
"""
|
41
43
|
import codecs
|
42
44
|
import colorama
|
@@ -47,36 +49,38 @@ import sys
|
|
47
49
|
def invalid_run_command(msg=None):
|
48
50
|
exp = " ** mkfile **\n\n"
|
49
51
|
exp += " Usage:\n"
|
50
|
-
exp += "
|
51
|
-
exp += "
|
52
|
+
exp += " seleniumbase mkfile [FILE.py] [OPTIONS]\n"
|
53
|
+
exp += " OR sbase mkfile [FILE.py] [OPTIONS]\n"
|
52
54
|
exp += " Example:\n"
|
53
|
-
exp += "
|
55
|
+
exp += " sbase mkfile new_test.py\n"
|
54
56
|
exp += " Options:\n"
|
55
|
-
exp += "
|
56
|
-
exp += "
|
57
|
-
exp += "
|
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"
|
58
61
|
exp += " Language Options:\n"
|
59
|
-
exp += "
|
60
|
-
exp += "
|
61
|
-
exp += "
|
62
|
-
exp += "
|
63
|
-
exp += "
|
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"
|
64
67
|
exp += " Syntax Formats:\n"
|
65
|
-
exp += "
|
66
|
-
exp += "
|
67
|
-
exp += "
|
68
|
-
exp += "
|
69
|
-
exp += "
|
70
|
-
exp += "
|
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"
|
71
74
|
exp += " Output:\n"
|
72
|
-
exp += "
|
73
|
-
exp += "
|
74
|
-
exp += "
|
75
|
-
exp += "
|
76
|
-
exp += '
|
77
|
-
exp += '
|
78
|
-
exp += '
|
79
|
-
exp += "
|
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"
|
80
84
|
if not msg:
|
81
85
|
raise Exception("INVALID RUN COMMAND!\n\n%s" % exp)
|
82
86
|
elif msg == "help":
|
@@ -92,19 +96,13 @@ def main():
|
|
92
96
|
c7 = ""
|
93
97
|
cr = ""
|
94
98
|
if "linux" not in sys.platform:
|
95
|
-
if (
|
96
|
-
"win32" in sys.platform
|
97
|
-
and hasattr(colorama, "just_fix_windows_console")
|
98
|
-
):
|
99
|
-
colorama.just_fix_windows_console()
|
100
|
-
else:
|
101
|
-
colorama.init(autoreset=True)
|
102
99
|
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
|
103
100
|
c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
|
104
101
|
c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
|
105
102
|
cr = colorama.Style.RESET_ALL
|
106
103
|
|
107
104
|
basic = False
|
105
|
+
use_uc = False
|
108
106
|
help_me = False
|
109
107
|
recorder = False
|
110
108
|
error_msg = None
|
@@ -152,6 +150,9 @@ def main():
|
|
152
150
|
recorder = True
|
153
151
|
elif option == "--record" or option == "--recorder":
|
154
152
|
recorder = True
|
153
|
+
elif use_uc:
|
154
|
+
# UC must use English & ContextManager formats
|
155
|
+
continue
|
155
156
|
elif option == "--en" or option == "--english":
|
156
157
|
language = "English"
|
157
158
|
elif option == "--zh" or option == "--chinese":
|
@@ -184,6 +185,11 @@ def main():
|
|
184
185
|
syntax = "DriverContext"
|
185
186
|
elif option == "--dm" or option == "--driver-manager":
|
186
187
|
syntax = "DriverManager"
|
188
|
+
elif option == "--uc":
|
189
|
+
basic = True
|
190
|
+
language = "English"
|
191
|
+
syntax = "ContextManager"
|
192
|
+
use_uc = True
|
187
193
|
else:
|
188
194
|
invalid_cmd = "\n===> INVALID OPTION: >> %s <<\n" % option
|
189
195
|
invalid_cmd = invalid_cmd.replace(">> ", ">>" + c5 + " ")
|
@@ -319,16 +325,22 @@ def main():
|
|
319
325
|
data = []
|
320
326
|
data.append("from seleniumbase import SB")
|
321
327
|
data.append("")
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
328
|
+
if use_uc:
|
329
|
+
data.append('with SB(uc=True) as sb:')
|
330
|
+
else:
|
331
|
+
data.append('with SB(browser="chrome") as sb:')
|
332
|
+
if use_uc:
|
333
|
+
data.append(' url = "%s"' % url)
|
334
|
+
data.append(" sb.uc_open_with_reconnect(url, 4)")
|
335
|
+
data.append(" sb.uc_gui_click_captcha()")
|
336
|
+
else:
|
337
|
+
data.append(' sb.open("%s")' % url)
|
326
338
|
if not basic:
|
327
339
|
data.append(' sb.type("input", "Goodbye") # selector, text')
|
328
|
-
data.append(' sb.click("html body >
|
340
|
+
data.append(' sb.click("html body > p") # selector')
|
329
341
|
data.append(' sb.assert_element("input") # selector')
|
330
|
-
data.append(' sb.assert_text("Hello", "
|
331
|
-
data.append(' sb.highlight("
|
342
|
+
data.append(' sb.assert_text("Hello", "p") # text, selector')
|
343
|
+
data.append(' sb.highlight("p") # selector')
|
332
344
|
data.append(" sb.sleep(0.5) # seconds")
|
333
345
|
data.append("")
|
334
346
|
new_data = data
|
@@ -337,7 +349,14 @@ def main():
|
|
337
349
|
data.append("from seleniumbase import DriverContext")
|
338
350
|
data.append("")
|
339
351
|
data.append('with DriverContext(browser="chrome") as driver:')
|
340
|
-
data.append(' driver.get("
|
352
|
+
data.append(' driver.get("%s")' % url)
|
353
|
+
if not basic:
|
354
|
+
data.append(' driver.type("input", "Goodbye") # sel, text')
|
355
|
+
data.append(' driver.click("html body > p") # selector')
|
356
|
+
data.append(' driver.assert_element("input") # selector')
|
357
|
+
data.append(' driver.assert_text("Hello", "p") # text, sel')
|
358
|
+
data.append(' driver.highlight("p") # selector')
|
359
|
+
data.append(" driver.sleep(0.5) # seconds")
|
341
360
|
data.append("")
|
342
361
|
new_data = data
|
343
362
|
elif language == "English" and syntax == "DriverManager":
|
@@ -346,7 +365,14 @@ def main():
|
|
346
365
|
data.append("")
|
347
366
|
data.append('driver = Driver(browser="chrome")')
|
348
367
|
data.append("try:")
|
349
|
-
data.append(' driver.get("
|
368
|
+
data.append(' driver.get("%s")' % url)
|
369
|
+
if not basic:
|
370
|
+
data.append(' driver.type("input", "Goodbye") # sel, text')
|
371
|
+
data.append(' driver.click("html body > p") # selector')
|
372
|
+
data.append(' driver.assert_element("input") # selector')
|
373
|
+
data.append(' driver.assert_text("Hello", "p") # text, sel')
|
374
|
+
data.append(' driver.highlight("p") # selector')
|
375
|
+
data.append(" driver.sleep(0.5) # seconds")
|
350
376
|
data.append("finally:")
|
351
377
|
data.append(" driver.quit()")
|
352
378
|
data.append("")
|
@@ -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 += "
|
35
|
-
exp += "
|
34
|
+
exp += " seleniumbase mkpres [FILE.py] [LANG]\n"
|
35
|
+
exp += " OR sbase mkpres [FILE.py] [LANG]\n"
|
36
36
|
exp += " Example:\n"
|
37
|
-
exp += "
|
37
|
+
exp += " sbase mkpres new_presentation.py --en\n"
|
38
38
|
exp += " Language Options:\n"
|
39
|
-
exp += "
|
40
|
-
exp += "
|
41
|
-
exp += "
|
42
|
-
exp += "
|
43
|
-
exp += "
|
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 += "
|
46
|
-
exp += "
|
47
|
-
exp += "
|
48
|
-
exp += '
|
49
|
-
exp += "
|
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
|