次のカスタムRetryAttribute
を持っています:NUnit retry dynamic attribute。それはうまく動作しますが、私はセレンのタイムアウトエラーが発生したとき、それは動作しません。C# - Selenium再試行属性がSeleniumタイムアウトで機能しない
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5));
wait.Until(ExpectedConditions.ElementToBeClickable(element));
リトライカスタム属性:
/// <summary>
/// RetryDynamicAttribute may be applied to test case in order
/// to run it multiple times based on app setting.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public class RetryDynamicAttribute : RetryAttribute {
private const int DEFAULT_TRIES = 1;
static Lazy<int> numberOfRetries = new Lazy<int>(() => {
int count = 0;
return int.TryParse(ConfigurationManager.AppSettings["retryTest"], out count) ? count : DEFAULT_TRIES;
});
public RetryDynamicAttribute() :
base(numberOfRetries.Value) {
}
}
そして、カスタム属性を適用します。
[Test]
[RetryDynamic]
public void Test() {
//....
}
どのように解決できますか?