我已经查看了所有答案,但似乎对我没有任何帮助,无论我做什么,我都无法覆盖页面加载的默认60秒驱动程序超时。即使在Selenium服务器上,当我设置全局超时值时,它也不适用。
ChromeOptions options = new ChromeOptions();
options = GetChromeOptions();
string projectPath = System.AppDomain.CurrentDomain.BaseDirectory;
IWebDriver test = new ChromeDriver(projectPath,options, TimeSpan.FromMinutes(10));
test.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(2);
test.Manage().Timeouts().ImplicitWait = TimeSpan.FromMinutes(2);
设置的选项:
private static ChromeOptions GetChromeOptions()
{
var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("no-sandbox");
chromeOptions.AddUserProfilePreference("download.default_directory", Config.TempPath);
chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");
if (Config.IsHeadless)
{
chromeOptions.AddArgument("headless");
}
chromeOptions.AddArgument("--disable-dev-shm-usage");
chromeOptions.AddArgument("proxy-server='direct://'");
chromeOptions.AddArgument("proxy-bypass-list=*");
chromeOptions.SetLoggingPreference(LogType.Browser, Config.BrowserErrorLoggingType);
return chromeOptions;
}
服务器配置: Selenium Server Config