簡體   English   中英

如何在硒中動態更改Firefox驅動程序首選項

[英]How to dynamically change Firefox Driver preferences in selenium

我想下載多個文件並保存到不同的位置

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.dir", "D:\\");
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/msword");

System.setProperty("webdriver.chrome.driver","C:/Program Files/Mozilla Firefox/firefox.exe");
f   =new FirefoxDriver(profile);

for(int i = 0; i<10; i++){

//I want to change download dir name here with count**


}

只有幾種方法可以做到這一點。 驅動程序啟動后便無法更改下載目錄,因此始終可以選擇下載一個文件,重新啟動驅動程序,然后以相同的方式下載其他文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM