MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / get_downloaded_files

Method get_downloaded_files

seleniumbase/fixtures/base_case.py:8213–8225  ·  view source on GitHub ↗

Returns a list of files in the [Downloads Folder]. Depending on settings, that dir may have other files. If regex is provided, uses that to filter results.

(self, regex=None, browser=False)

Source from the content-addressed store, hash-verified

8211 return os.path.join(os.path.expanduser("~"), "downloads")
8212
8213 def get_downloaded_files(self, regex=None, browser=False):
8214 """Returns a list of files in the [Downloads Folder].
8215 Depending on settings, that dir may have other files.
8216 If regex is provided, uses that to filter results."""
8217 df = self.get_downloads_folder()
8218 if browser:
8219 df = self.get_browser_downloads_folder()
8220 if not os.path.exists(df):
8221 return []
8222 elif regex:
8223 return [fn for fn in os.listdir(df) if re.match(regex, fn)]
8224 else:
8225 return os.listdir(df)
8226
8227 def get_path_of_downloaded_file(self, file, browser=False):
8228 """Returns the full OS path of the downloaded file."""

Callers

nothing calls this directly

Calls 2

get_downloads_folderMethod · 0.95

Tested by

no test coverage detected