это мой код (я пишу этот код в контроллере, а не в модульном тесте):
Код: Выделить всё
private void OpenBrowser()
{
try
{
string strChromeDriver = System.Configuration.ConfigurationManager.AppSettings["BinaryLocationChrome"];
string strdownloadsPath = System.Configuration.ConfigurationManager.AppSettings["DownloadPath"];
var options = new ChromeOptions();
options.AddArgument("disable-blink-features=AutomationControlled");
options.AddArgument("no-sandbox");
options.AddArgument("--remote-debugging-port=0");
options.AddArguments("--incognito", "--disable-popup-blocking", "safebrowsing-disable-download-protection", "allow-unchecked-dangerous-downloads");
options.AddUserProfilePreference("download.default_directory", strdownloadsPath);
options.AddUserProfilePreference("intl.accept_languages", "nl");
options.AddUserProfilePreference("disable-popup-blocking", "true");
options.AddArgument("--log-level=3");
try
{
var driver = new ChromeDriver(strChromeDriver, options);
driver.Navigate().GoToUrl("www.example.com");
}
catch (Exception e)
{
Debug.WriteLine(">> FAILED " + " - " + e.ToString());
}
}
catch (Exception e)
{
Debug.WriteLine("** FAILED ** " + e.ToString());
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... sp-net-mvc
Мобильная версия