Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does the "downloaded_files" folder work? #1557

Closed
M-Zubair10 opened this issue Oct 22, 2022 · 2 comments
Closed

How does the "downloaded_files" folder work? #1557

M-Zubair10 opened this issue Oct 22, 2022 · 2 comments
Labels
question Someone is looking for answers

Comments

@M-Zubair10
Copy link

SeleniumBase Driver creates downlaod_files folder inside my working dir when initialized
This is weird, it must be inside pypi package folder

@mdmintz mdmintz added the question Someone is looking for answers label Oct 22, 2022
@mdmintz
Copy link
Member

mdmintz commented Oct 22, 2022

SeleniumBase creates the downloaded_files folder in the working directory where pytest is invoked. Any click-initiated downloads will go there. It's also used for any special files needed. It also holds lock files to prevent issues with multi-threading. The folder resets at the start of every new pytest run so that past test runs don't interfere with new ones. The folder is hard-coded there to prevent issues. And since the folder is reset at the start of new pytest runs, you wouldn't want to use any other existing folders for it.

There are lots of built-in test methods that are specially made for that folder, such as:

self.get_downloads_folder()

self.get_browser_downloads_folder()

self.get_path_of_downloaded_file(file)

self.is_downloaded_file_present(file)

self.delete_downloaded_file_if_present(file)
# Duplicates: self.delete_downloaded_file(file)

self.assert_downloaded_file(file)

If you need files in a different folder, use Python os, sys, and shutil libraries for copying the files you need into a different folder after they get downloaded to the downloaded_files folder.

@M-Zubair10
Copy link
Author

M-Zubair10 commented Oct 22, 2022 via email

@mdmintz mdmintz changed the title Unhandled dir How does the "downloaded_files" folder work? Oct 22, 2022
@mdmintz mdmintz closed this as completed Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Someone is looking for answers
Projects
None yet
Development

No branches or pull requests

2 participants