This is my solution, I refer to: How to set Chrome settings using Selenium Webdriver.NET binding?
But it doesnβt work, I need to change the default download directory for google chrome to
C: \ Temp \
Thanks for the help.
public class ChromeOptionsWithPrefs : ChromeOptions { public Dictionary<string, object> prefs { get; set; } } public static void Initialize() { var options = new ChromeOptionsWithPrefs { prefs = new Dictionary<string, object> { {"download.default_directory", @"C:\temp\"} } }; RemoteWebDriver driver = new ChromeDriver(@"D:\chromedriver_win32\", options); var download = driver.FindElements(By.XPath("//a[.='Download']")); foreach (var t in download) { t.SendKeys(Keys.Enter); } }
Im found this solution, it worked
var chromeOptions = new ChromeOptions(); chromeOptions.AddUserProfilePreference("download.default_directory", @"D:\DataTest"); chromeOptions.AddUserProfilePreference("intl.accept_languages", "nl"); chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true"); var driver = new ChromeDriver(@"D:\chromedriver_win32\", chromeOptions); var download = driver.FindElements(By.XPath("//a[.='γγ¦γ³γγΌγ']")); foreach (var t in download) { t.SendKeys(Keys.Enter); }
c # google-chrome selenium selenium-webdriver
Lamd7
source share