6
6
iedriver|operadriver} [OPTIONS]
7
7
Options:
8
8
VERSION Specify the version.
9
- (Default Chromedriver version = 2.44)
9
+ (Default chromedriver version = 2.44)
10
10
Use "latest" for the latest version.
11
11
-p OR --path Also copy the driver to /usr/local/bin
12
12
Example:
@@ -51,7 +51,7 @@ def invalid_run_command():
51
51
exp += " iedriver, operadriver)\n "
52
52
exp += " Options:\n "
53
53
exp += " VERSION Specify the version.\n "
54
- exp += " (Default Chromedriver version = 2.44)\n "
54
+ exp += " (Default chromedriver version = 2.44)\n "
55
55
exp += ' Use "latest" for the latest version.\n '
56
56
exp += " -p OR --path Also copy the driver to /usr/local/bin\n "
57
57
exp += " Example:\n "
@@ -79,7 +79,12 @@ def make_executable(file_path):
79
79
os .chmod (file_path , mode )
80
80
81
81
82
- def main ():
82
+ def main (override = None ):
83
+ if override == "chromedriver" :
84
+ sys .argv = ["seleniumbase" , "install" , "chromedriver" ]
85
+ if override == "geckodriver" :
86
+ sys .argv = ["seleniumbase" , "install" , "geckodriver" ]
87
+
83
88
num_args = len (sys .argv )
84
89
if sys .argv [0 ].split ('/' )[- 1 ].lower () == "seleniumbase" or (
85
90
sys .argv [0 ].split ('\\ ' )[- 1 ].lower () == "seleniumbase" ):
@@ -123,7 +128,7 @@ def main():
123
128
elif "win32" in sys_plat or "win64" in sys_plat or "x64" in sys_plat :
124
129
file_name = "chromedriver_win32.zip" # Works for win32 / win_x64
125
130
else :
126
- raise Exception ("Cannot determine which version of Chromedriver "
131
+ raise Exception ("Cannot determine which version of chromedriver "
127
132
"to download!" )
128
133
found_chromedriver = False
129
134
if get_latest :
@@ -138,9 +143,9 @@ def main():
138
143
if not found_chromedriver :
139
144
url_request = requests .get (download_url )
140
145
if found_chromedriver or url_request .ok :
141
- print ("\n Chromedriver version for download = %s" % use_version )
146
+ print ("\n * chromedriver version for download = %s" % use_version )
142
147
else :
143
- raise Exception ("Could not find Chromedriver to download!\n " )
148
+ raise Exception ("Could not find chromedriver to download!\n " )
144
149
elif name == "geckodriver" or name == "firefoxdriver" :
145
150
use_version = DEFAULT_GECKODRIVER_VERSION
146
151
found_geckodriver = False
@@ -174,7 +179,7 @@ def main():
174
179
elif "win32" in sys_plat or "win64" in sys_plat or "x64" in sys_plat :
175
180
file_name = "geckodriver-%s-win64.zip" % use_version
176
181
else :
177
- raise Exception ("Cannot determine which version of Geckodriver "
182
+ raise Exception ("Cannot determine which version of geckodriver "
178
183
"(Firefox Driver) to download!" )
179
184
download_url = ("https://github.com/mozilla/geckodriver/"
180
185
"releases/download/"
@@ -183,9 +188,9 @@ def main():
183
188
if not found_geckodriver :
184
189
url_request = requests .get (download_url )
185
190
if found_geckodriver or url_request .ok :
186
- print ("\n Geckodriver version for download = %s" % use_version )
191
+ print ("\n * geckodriver version for download = %s" % use_version )
187
192
else :
188
- raise Exception ("\n Could not find the specified Geckodriver "
193
+ raise Exception ("\n Could not find the specified geckodriver "
189
194
"version to download!\n " )
190
195
elif name == "edgedriver" or name == "msedgedriver" :
191
196
name = "edgedriver"
@@ -314,18 +319,13 @@ def main():
314
319
for f_name in contents :
315
320
new_file = downloads_folder + '/' + str (f_name )
316
321
print ("The file [%s] was saved to:\n %s\n " % (f_name , new_file ))
317
- print ("Making [%s] executable ..." % f_name )
322
+ print ("Making [%s %s ] executable ..." % ( f_name , use_version ) )
318
323
make_executable (new_file )
319
- print ("[%s] is now ready for use!\n " % f_name )
320
- print ('(If running on a Selenium Grid, copy [%s] to your '
321
- 'System PATH.\n '
322
- ' E.g. to the "/usr/local/bin/" folder on Linux '
323
- 'systems.)\n ' % name )
324
- print ("Location of [%s %s]:\n %s" % (
325
- f_name , use_version , new_file ))
324
+ print ("[%s] is now ready for use!" % f_name )
326
325
if copy_to_path and os .path .exists (LOCAL_PATH ):
327
326
path_file = LOCAL_PATH + f_name
328
327
shutil .copyfile (new_file , path_file )
328
+ make_executable (path_file )
329
329
print ("Also copied to: %s" % path_file )
330
330
print ("" )
331
331
elif name == "edgedriver" or name == "msedgedriver" :
@@ -367,12 +367,10 @@ def main():
367
367
os .rmdir (downloads_folder + '/' + "Driver_Notes/" )
368
368
print ("The file [%s] was saved to:\n %s\n " % (
369
369
driver_file , driver_path ))
370
- print ("Making [%s] executable ..." % driver_file )
370
+ print ("Making [%s %s ] executable ..." % ( driver_file , use_version ) )
371
371
make_executable (driver_path )
372
- print ("[%s] is now ready for use!\n " % driver_file )
372
+ print ("[%s] is now ready for use!" % driver_file )
373
373
print ("Add folder path of Edge to System Environmental Variables!" )
374
- print ("\n Location of [%s %s]:\n %s" % (
375
- driver_file , use_version , driver_path ))
376
374
print ("" )
377
375
elif name == "operadriver" :
378
376
if len (contents ) != 3 :
@@ -403,14 +401,13 @@ def main():
403
401
shutil .copyfile (inner_driver , driver_path )
404
402
print ("The file [%s] was saved to:\n %s\n " % (
405
403
driver_file , driver_path ))
406
- print ("Making [%s] executable ..." % driver_file )
404
+ print ("Making [%s %s ] executable ..." % ( driver_file , use_version ) )
407
405
make_executable (driver_path )
408
- print ("[%s] is now ready for use!\n " % driver_file )
409
- print ("Location of [%s %s]:\n %s" % (
410
- driver_file , use_version , driver_path ))
406
+ print ("[%s] is now ready for use!" % driver_file )
411
407
if copy_to_path and os .path .exists (LOCAL_PATH ):
412
408
path_file = LOCAL_PATH + driver_file
413
409
shutil .copyfile (driver_path , path_file )
410
+ make_executable (path_file )
414
411
print ("Also copied to: %s" % path_file )
415
412
# Clean up extra files
416
413
if os .path .exists (inner_driver ):
@@ -444,18 +441,13 @@ def main():
444
441
for f_name in contents :
445
442
new_file = downloads_folder + '/' + str (f_name )
446
443
print ("The file [%s] was saved to:\n %s\n " % (f_name , new_file ))
447
- print ("Making [%s] executable ..." % f_name )
444
+ print ("Making [%s %s ] executable ..." % ( f_name , use_version ) )
448
445
make_executable (new_file )
449
- print ("[%s] is now ready for use!\n " % f_name )
450
- print ('(If running on a Selenium Grid, copy [%s] to your '
451
- 'System PATH.\n '
452
- ' E.g. to the "/usr/local/bin/" folder on Linux '
453
- 'systems.)\n ' % name )
454
- print ("Location of [%s %s]:\n %s" % (
455
- f_name , use_version , new_file ))
446
+ print ("[%s] is now ready for use!" % f_name )
456
447
if copy_to_path and os .path .exists (LOCAL_PATH ):
457
448
path_file = LOCAL_PATH + f_name
458
449
shutil .copyfile (new_file , path_file )
450
+ make_executable (path_file )
459
451
print ("Also copied to: %s" % path_file )
460
452
print ("" )
461
453
elif len (contents ) == 0 :
@@ -467,7 +459,7 @@ def main():
467
459
if "Driver" in file_name or "driver" in file_name :
468
460
print ("Making [%s] executable ..." % file_name )
469
461
make_executable (file_path )
470
- print ("[%s] is now ready for use!\n " % file_name )
462
+ print ("[%s] is now ready for use!" % file_name )
471
463
print ("Location of [%s]:\n %s\n " % (file_name , file_path ))
472
464
473
465
0 commit comments