在SlimerJS中处理下载对话框 [英] Handle download dialog box in SlimerJS

查看:100
本文介绍了在SlimerJS中处理下载对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个脚本,该脚本单击可以下载mp3文件的链接.我面临的问题是,当脚本模拟对该链接的单击时,将弹出一个下载对话框,如下所示:
下载对话框

I have written a script that clicks on a link which can download a mp3 file. The problem I am facing is when the script simulates the click on that link, a download dialog box pops up like this:
Download Dialog Box

现在,我想将此文件保存到我选择的某个路径并自动执行整个过程.我对如何处理此对话框一无所知.

Now, I want to save this file to some path of my choice and automate this whole process. I am clueless on how to handle this dialog box.

推荐答案

Firefox生成一个包含内容的临时"downloadfile.extension.part"文件.只需简单地重命名文件ex. myfile.csv.part> myfile.csv

Firefox generates a temp "downloadfile.extension.part" file which contains the content. Just simply rename the file ex. myfile.csv.part > myfile.csv

如果在Mac上本地运行,则应在linux/temp/文件夹的downloads目录中找到.part文件

locally if working on a mac you should find the .part file in the downloads directory, on linux /temp/ folder

这不是最优雅的解决方案,但应该可以解决问题

Not the most elegant solution but should do the trick

这篇关于在SlimerJS中处理下载对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆