Dies ist meine Lösung, ich bin Bezug auf: How to set Chrome preferences using Selenium Webdriver .NET binding?C# Standard-Download-Verzeichnis Chrome WebDriver festlegen?
Aber nicht funktioniert, ich brauche für Google Chrome
C Standard-Download-Verzeichnis ändern: \
\ temp Danke für die Hilfe.
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 finded diese Lösung, es
arbeitete Einfügenvar 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);
}
Sie nicht Ihre Antworten in der Frage geben. Fügen Sie es einfach als Antwort .. – Adarsha
doppelte Frage hier https://stackoverflow.com/questions/33434443/download-file-at-custom-path-using-selenium-webdriver –