我正在尝试在Firefox中使用节点selenium来点击浏览器中的链接,然后触发下载excel文件。我想将文件下载到一个设置目录,但是当单击该链接时,会出现一个对话框,询问我是要保存文件还是打开它。我已尝试在代码和Firefox浏览器中设置选项,但没有运气。这是我目前使用的代码......
kubectl describe node ip-x-x-x-x.ap-southeast-2.compute.internal
...
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
CPU Requests CPU Limits Memory Requests Memory Limits
------------ ---------- --------------- -------------
225m (11%) 200m (10%) 125Mi (1%) 300Mi (3%)
Events: <none>
答案 0 :(得分:0)
试试代码:
let options = new firefox.Options();
options.setPreference("browser.download.folderList", 2);
options.setPreference("browser.download.dir", "C:\\recapp_excel");
options.setPreference("browser.download.useDownloadDir", true);
options.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/vnd.ms-excel");
options.setPreference("pdfjs.disabled", true); // disable the built-in PDF viewer
参考: