@@ -114,6 +114,13 @@ def handle_args():
114114 help = "Force the echo360.py script to download a local \
115115 binary file for phantomjs (will override system bin)" ,
116116 )
117+ parser .add_argument (
118+ "--stealth" ,
119+ action = "store_true" ,
120+ default = False ,
121+ dest = "use_stealth" ,
122+ help = "Use Stealth Chrome Driver to bypass some bot detection (e.g. useful for FIDO)." ,
123+ )
117124 parser .add_argument (
118125 "--chrome" ,
119126 action = "store_true" ,
@@ -222,7 +229,9 @@ def handle_args():
222229 _LOGGER .debug ("Hostname: %s, UUID: %s" , course_hostname , course_url )
223230
224231 webdriver_to_use = "phantomjs"
225- if args ["use_chrome" ]:
232+ if args ["use_stealth" ]:
233+ webdriver_to_use = "stealth"
234+ elif args ["use_chrome" ]:
226235 webdriver_to_use = "chrome"
227236 elif args ["use_firefox" ]:
228237 webdriver_to_use = "firefox"
@@ -305,28 +314,32 @@ def cmd_exists(x):
305314 )
306315
307316 binary_type = "geckodriver"
317+ elif webdriver_to_use == "stealth" :
318+ binary_type = None
308319 else :
309320 from .binary_downloader .phantomjs import (
310321 PhantomjsDownloader as binary_downloader ,
311322 )
312323
313324 binary_type = "phantomjs"
314- binary_downloader = binary_downloader () # initialise class
315- _LOGGER .debug (
316- "binary_downloader link: %s, bin path: %s" ,
317- binary_downloader .get_download_link (),
318- binary_downloader .get_bin (),
319- )
320- # First test for existance of localbinary file
321- if not os .path .isfile (binary_downloader .get_bin ()):
322- # If failed, then test for existance of global executable in PATH
323- if cmd_exists (binary_type ):
324- use_local_binary = False
325- _LOGGER .debug ("Using global binary file" )
326- else :
327- # None exists, download binary file
328- start_download_binary (binary_downloader , binary_type )
329- _LOGGER .debug ("Downloading binary file" )
325+
326+ if binary_type :
327+ binary_downloader = binary_downloader () # initialise class
328+ _LOGGER .debug (
329+ "binary_downloader link: %s, bin path: %s" ,
330+ binary_downloader .get_download_link (),
331+ binary_downloader .get_bin (),
332+ )
333+ # First test for existance of localbinary file
334+ if not os .path .isfile (binary_downloader .get_bin ()):
335+ # If failed, then test for existance of global executable in PATH
336+ if cmd_exists (binary_type ):
337+ use_local_binary = False
338+ _LOGGER .debug ("Using global binary file" )
339+ else :
340+ # None exists, download binary file
341+ start_download_binary (binary_downloader , binary_type )
342+ _LOGGER .debug ("Downloading binary file" )
330343
331344 if download_binary :
332345 start_download_binary (binary_downloader , binary_type , manual = True )
0 commit comments