@@ -43,7 +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
+ exp += " --gui / --headed (Use headed mode on Linux .)\n "
47
47
exp += " Output:\n "
48
48
exp += " Creates a new SeleniumBase test using the Recorder.\n "
49
49
exp += " If the filename already exists, an error is raised.\n "
@@ -55,6 +55,7 @@ def invalid_run_command(msg=None):
55
55
else :
56
56
raise Exception ("INVALID RUN COMMAND!\n \n %s\n %s\n " % (exp , msg ))
57
57
58
+
58
59
def set_colors (use_colors ):
59
60
c0 = ""
60
61
c1 = ""
@@ -74,16 +75,18 @@ def set_colors(use_colors):
74
75
75
76
76
77
def main ():
77
-
78
78
help_me = False
79
79
error_msg = None
80
80
invalid_cmd = None
81
81
use_edge = False
82
82
start_page = None
83
83
next_is_url = False
84
+ use_colors = True
85
+ force_gui = False
84
86
85
- use_browser = ("linux" not in sys .platform )
86
- c0 , c1 , c2 , c5 , c7 , cr = set_colors (use_browser )
87
+ if "linux" in sys .platform :
88
+ use_colors = False
89
+ c0 , c1 , c2 , c5 , c7 , cr = set_colors (use_colors )
87
90
88
91
command_args = sys .argv [2 :]
89
92
file_name = command_args [0 ]
@@ -110,16 +113,20 @@ def main():
110
113
help_me = True
111
114
elif option .lower () == "--edge" :
112
115
use_edge = True
116
+ elif (
117
+ option .lower () in ("--gui" , "--headed" )
118
+ and "linux" in sys .platform
119
+ ):
120
+ use_colors = True
121
+ c0 , c1 , c2 , c5 , c7 , cr = set_colors (use_colors )
122
+ force_gui = True
113
123
elif option .lower ().startswith ("--url=" ):
114
124
start_page = option [len ("--url=" ):]
115
125
elif option .lower () == "--url" :
116
126
next_is_url = True
117
127
elif next_is_url :
118
128
start_page = option
119
129
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 )
123
130
else :
124
131
invalid_cmd = "\n ===> INVALID OPTION: >> %s <<\n " % option
125
132
invalid_cmd = invalid_cmd .replace (">> " , ">>" + c5 + " " )
@@ -153,17 +160,18 @@ def main():
153
160
print (success )
154
161
if not start_page :
155
162
run_cmd = "pytest %s --rec -q -s" % file_name
156
- if use_browser :
157
- if use_edge :
158
- run_cmd += " --edge"
159
- else :
160
- run_cmd += " --chrome"
163
+ if use_edge :
164
+ run_cmd += " --edge"
165
+ if force_gui :
166
+ run_cmd += " --gui"
161
167
print (run_cmd )
162
168
os .system (run_cmd )
163
169
else :
164
170
run_cmd = "pytest %s --rec -q -s --url=%s" % (file_name , start_page )
165
171
if use_edge :
166
172
run_cmd += " --edge"
173
+ if force_gui :
174
+ run_cmd += " --gui"
167
175
print (run_cmd )
168
176
os .system (run_cmd )
169
177
if os .path .exists (file_path ):
0 commit comments