-
Notifications
You must be signed in to change notification settings - Fork 65
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
New download action #303
base: main
Are you sure you want to change the base?
New download action #303
Conversation
I'm still learning and apologize for any mistakes. I'm open to corrections and feedback. Thank you for your understanding! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @RohitP2005 ! This looks good, could you please add the following:
- remove calls to print() when executing the action
- write a unit test to test this
elem = get_elem_by_bid(page, bid, demo_mode != "off") | ||
add_demo_mode_effects(page, elem, bid, demo_mode=demo_mode, move_cursor=True) | ||
|
||
print("Starting download...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful for debugging but should be removed once your code is working. Please remove these.
# Monitor the download progress | ||
start_time = time.time() | ||
while not download.is_done(): | ||
time.sleep(1) | ||
elapsed_time = time.time() - start_time | ||
print(f"Downloading... Elapsed time: {int(elapsed_time)} seconds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. This for loop is not needed in the end, the save_as call will wait for the download to complete.
download.save_as(file_path) | ||
|
||
# Notify the user about download completion | ||
print(f"Download completed: {file_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed.
@recursix can you have a look as well? This action can potentially overwrite files on the filesystem, do you think we should do something about it? We discussed that with @ThibaultLSDC a while ago, ideally we could provide a safe directory for all file_upload and file_download operations, which would be enforced to prevent the agent reading / writing stuff anywhere on the file system. |
No worries at all, we are all making mistakes and still learning :) |
Thanks you, I also think we should have a dedicated directory for this action. |
hey @recursix any updates on the dir of file_download options |
Pull Request Description - #298
Summary of Changes:
download_file
function to handle file downloads by clicking a specified element (bid
).Reason for Changes:
Example:
Starting Download:
Starting download...
During Download:
Download completed: downloads/my_report.pdf
How to Test:
download_file
with a validbid
and optionaldownload_path
.