我想更改chrome的默认下载目录。我确实经历了以下网址中列出的不同论点
http://peter.sh/experiments/chromium-command-line-switches/
和
http://code.google.com/p/chromedriver/wiki/CapabilitiesAndSwitches
我想知道在chrome web driver C#中如何在运行时更改下载文件夹, 提前谢谢
答案 0 :(得分:0)
试试这个。
namespace UnitTestProject1_webdriver
{
public class ChromeOptionsWithPrefs : ChromeOptions
{
public Dictionary<string, object> prefs { get; set; }
}
[TestClass]
public class demo
{
[TestMethod]
public void demo1()
{var options = new ChromeOptionsWithPrefs();
options.prefs = new Dictionary<string, object>
{
{ "download.default_directory", @"c:\download temp\" }
};
RemoteWebDriver driver = new ChromeDriver(@"d:\selenium dlls\", options);
}
}
}