【发布时间】:2016-03-17 14:21:22
【问题描述】:
我是 selenium 新手,我想知道如何获取操作系统中浏览器(我使用的是 chrome)的下载文件夹的默认路径。
我刚刚找到了一种方法来设置这样的默认路径:
var chromeOptions = new ChromeOptions();
chromeOptions.AddUserProfilePreference("download.default_directory", path);
chromeOptions.AddUserProfilePreference("intl.accept_languages", "nl");
chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");
var driver = new ChromeDriver("Driver_Path", chromeOptions);
【问题讨论】:
-
你好,你可能想看看这个问题,我知道是关于 python 但有一个 C# 的答案,第一个:stackoverflow.com/questions/16328801/…
-
@IvanRascon 但他好像在定义下载路径我只需要获取当前的默认下载路径
-
@GroundIns 你能得到chrome浏览器的下载目录吗?
标签: c# selenium selenium-chromedriver