@@ -43,6 +43,7 @@ def invalid_run_command(msg=None):
43
43
exp += " Options:\n "
44
44
exp += " --url=URL (Sets the initial start page URL.)\n "
45
45
exp += " --edge (Use Edge browser instead of Chrome.)\n "
46
+ exp += " --ui or --headed (For linux: use browser instead of headless.)\n "
46
47
exp += " Output:\n "
47
48
exp += " Creates a new SeleniumBase test using the Recorder.\n "
48
49
exp += " If the filename already exists, an error is raised.\n "
@@ -54,22 +55,25 @@ def invalid_run_command(msg=None):
54
55
else :
55
56
raise Exception ("INVALID RUN COMMAND!\n \n %s\n %s\n " % (exp , msg ))
56
57
57
-
58
- def main ():
58
+ def set_colors (use_colors ):
59
59
c0 = ""
60
60
c1 = ""
61
61
c2 = ""
62
62
c5 = ""
63
63
c7 = ""
64
64
cr = ""
65
- if "linux" not in sys . platform :
65
+ if use_colors :
66
66
colorama .init (autoreset = True )
67
67
c0 = colorama .Fore .BLUE + colorama .Back .LIGHTCYAN_EX
68
68
c1 = colorama .Fore .RED + colorama .Back .LIGHTYELLOW_EX
69
69
c2 = colorama .Fore .LIGHTRED_EX + colorama .Back .LIGHTYELLOW_EX
70
70
c5 = colorama .Fore .RED + colorama .Back .LIGHTYELLOW_EX
71
71
c7 = colorama .Fore .BLACK + colorama .Back .MAGENTA
72
72
cr = colorama .Style .RESET_ALL
73
+ return c0 , c1 , c2 , c5 , c7 , cr
74
+
75
+
76
+ def main ():
73
77
74
78
help_me = False
75
79
error_msg = None
@@ -78,6 +82,9 @@ def main():
78
82
start_page = None
79
83
next_is_url = False
80
84
85
+ use_browser = ("linux" not in sys .platform )
86
+ c0 , c1 , c2 , c5 , c7 , cr = set_colors (use_browser )
87
+
81
88
command_args = sys .argv [2 :]
82
89
file_name = command_args [0 ]
83
90
if file_name == "-h" or file_name == "--help" :
@@ -110,6 +117,9 @@ def main():
110
117
elif next_is_url :
111
118
start_page = option
112
119
next_is_url = False
120
+ elif option .lower () in ('--gui' , '--headed' ):
121
+ use_browser = True
122
+ c0 , c1 , c2 , c5 , c7 , cr = set_colors (use_browser )
113
123
else :
114
124
invalid_cmd = "\n ===> INVALID OPTION: >> %s <<\n " % option
115
125
invalid_cmd = invalid_cmd .replace (">> " , ">>" + c5 + " " )
@@ -143,8 +153,11 @@ def main():
143
153
print (success )
144
154
if not start_page :
145
155
run_cmd = "pytest %s --rec -q -s" % file_name
146
- if use_edge :
147
- run_cmd += " --edge"
156
+ if use_browser :
157
+ if use_edge :
158
+ run_cmd += " --edge"
159
+ else :
160
+ run_cmd += " --chrome"
148
161
print (run_cmd )
149
162
os .system (run_cmd )
150
163
else :
0 commit comments