I want to use relative file path in Firefoxprofile function, I have tried all possible ways but its throwing error. Here is my code- profile.setPreference("browser.download.dir", "/downloaded_files/");
folder "downloaded_files" is saved in root directory of my project. I tried all combinations of /,//,\\ still its not downloading filed in desired folder.
Try the following
profile.setPreference("browser.download.dir", "./downloaded_files/");
Or
String workingDir = System.getProperty("user.dir");
profile.setPreference("browser.download.dir", workingDir +"/downloaded_files/");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.