我使用Coypu进行了以下测试:
var options = new Options { Timeout = TimeSpan.FromSeconds(1) };
using (var browser = GetFreshBrowserSession())
{
browser.Visit(TestParamNames.LoginUri.GetParameterByName() + "candidateportal/en-US/" + TestParamNames.Namespace.GetParameterByName());
Assert.True(browser.FindCss("body > div.header > a.nav-item.job-search.selected > span.header-text", "Job Search", options).Exists());
Assert.True(browser.FindField("keyword", options).Exists());
Assert.True(browser.FindCss("body > div.content-wrapper > div.center.search-pane > form > span > span > input", options).Exists());
Assert.True(browser.FindButton("Search", options).Exists());
Assert.True(browser.FindButton("Reset", options).Exists());
Assert.True(browser.FindCss("div#advanced-search-link","Advanced Search", options).Exists());
}
如您所见,我将带有超时的选项传递给每个方法。是否可以设置默认超时一次并避免将其明确传递给每个方法?