![](/img/trans.png)
[英]Unable to download a file by setting Firefox profile using Selenium Webdriver
[英]How to use relative file path for firefox profile in Selenium webdriver using java?
我想在Firefoxprofile函數中使用相對文件路徑,我嘗試了所有可能的方法,但拋出錯誤。 這是我的代碼profile.setPreference(“ browser.download.dir”,“ / downloaded_files /”);
文件夾“ downloaded_files”保存在我項目的根目錄中。 我嘗試了/,//,\\的所有組合,但仍未將其下載歸檔到所需的文件夾中。
嘗試以下
profile.setPreference("browser.download.dir", "./downloaded_files/");
要么
String workingDir = System.getProperty("user.dir");
profile.setPreference("browser.download.dir", workingDir +"/downloaded_files/");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.