【问题标题】:Change the default chrome download folder webdriver C#更改默认 chrome 下载文件夹 webdriver C#
【发布时间】:2013-06-14 10:58:04
【问题描述】:

我想更改 chrome 的默认下载目录。我确实经历了以下网址中列出的不同论点
http://peter.sh/experiments/chromium-command-line-switches/

http://code.google.com/p/chromedriver/wiki/CapabilitiesAndSwitches

我想知道如何在运行时更改 chrome web driver C# 中的下载文件夹, 提前谢谢你

【问题讨论】:

标签: c# webdriver selenium-webdriver


【解决方案1】:

试试这个。

   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);
    }
 }


}

【讨论】:

  • 在运行时亲爱的.. 你应该删除这个答案
猜你喜欢
  • 2014-07-16
  • 2016-05-28
  • 2019-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-30
  • 2023-03-23
相关资源
最近更新 更多