public static By Within(this By by, TimeSpan timeout) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Timeout = timeout; return(extendedBy); }
public static By AtOnce(this By by) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Timeout = TimeSpan.Zero; return(extendedBy); }
public static By Safely(this By by, bool isSafely = true) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.IsSafely = isSafely; return(extendedBy); }
public static By Unsafely(this By by) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.IsSafely = false; return(extendedBy); }
public static By WithRetry(this By by, TimeSpan timeout, TimeSpan retryInterval) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Timeout = timeout; extendedBy.Options.RetryInterval = retryInterval; return extendedBy; }
public static By SafelyAndImmediately(this By by, bool isSafely = true) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.IsSafely = isSafely; extendedBy.Options.Timeout = TimeSpan.Zero; return extendedBy; }
public static By With(this By by, SearchOptions options) { options = options ?? new SearchOptions(); ExtendedBy extendedBy = new ExtendedBy(by); if (options.IsTimeoutSet) { extendedBy.Options.Timeout = options.Timeout; } if (options.IsRetryIntervalSet) { extendedBy.Options.RetryInterval = options.RetryInterval; } if (options.IsVisibilitySet) { extendedBy.Options.Visibility = options.Visibility; } if (options.IsSafelySet) { extendedBy.Options.IsSafely = options.IsSafely; } return(extendedBy); }
public static By With(this By by, Visibility visibility) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Visibility = visibility; return(extendedBy); }
public static By Within(this By by, TimeSpan timeout, TimeSpan retryInterval) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Timeout = timeout; extendedBy.Options.RetryInterval = retryInterval; return(extendedBy); }
public static By SafelyAtOnce(this By by, bool isSafely = true) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.IsSafely = isSafely; extendedBy.Options.Timeout = TimeSpan.Zero; return(extendedBy); }
public static By OfKind(this By by, string kind, string name = null) { ExtendedBy extendedBy = new ExtendedBy(by) { ElementKind = kind }; return(name != null?extendedBy.Named(name) : extendedBy); }
public ExtendedBy ApplySettingsFrom(ExtendedBy otherExtendedBy) { otherExtendedBy.CheckNotNull(nameof(otherExtendedBy)); ElementName = otherExtendedBy.ElementName; ElementKind = otherExtendedBy.ElementKind; Options = otherExtendedBy.Options.Clone(); return(this); }
public static By With(this By by, SearchOptions options) { options = options ?? SearchOptions.Unsafely(); ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Timeout = options.Timeout; extendedBy.Options.RetryInterval = options.RetryInterval; extendedBy.Options.Visibility = options.Visibility; extendedBy.Options.IsSafely = options.IsSafely; return extendedBy; }
public static By Named(this By by, string name) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.ElementName = name; if (name != null && extendedBy.ToString().Contains("{0}")) { return extendedBy.FormatWith(name); } return extendedBy; }
public static By Then(this By by, By nextBy) { ExtendedBy originalByAsExtended = by as ExtendedBy; By newByChain = TryResolveByChain(by, out ByChain byChain) ? new ByChain(byChain.Items.Concat(new[] { nextBy })) : new ByChain(originalByAsExtended?.By ?? by, nextBy); return(originalByAsExtended != null ? new ExtendedBy(newByChain).ApplySettingsFrom(originalByAsExtended) : newByChain); }
public static By Named(this By by, string name) { ExtendedBy extendedBy = new ExtendedBy(by) { ElementName = name }; if (name != null && extendedBy.ToString().Contains("{0}")) { return(extendedBy.FormatWith(name)); } return(extendedBy); }
internal ExtendedBy(By by) { by.CheckNotNull(nameof(by)); ExtendedBy byAsExtended = by as ExtendedBy; By = byAsExtended?.By ?? by; Description = By.ToString(); if (byAsExtended != null) { ApplySettingsFrom(byAsExtended); } else { Options = new SearchOptions(); } }
public static By FormatWith(this By by, params object[] args) { string selector = string.Format(by.GetSelector(), args); By formattedBy = CreateBy(by.GetMethod(), selector); ExtendedBy extendedBy = new ExtendedBy(formattedBy); ExtendedBy originalByAsExtended = by as ExtendedBy; if (originalByAsExtended != null) { extendedBy.ElementName = originalByAsExtended.ElementName; extendedBy.ElementKind = originalByAsExtended.ElementKind; extendedBy.Options = originalByAsExtended.Options; } return extendedBy; }
public static By OfKind(this By by, string kind, string name = null) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.ElementKind = kind; return name != null ? extendedBy.Named(name) : extendedBy; }
public static By Immediately(this By by) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Timeout = TimeSpan.Zero; return extendedBy; }
public static By WithRetry(this By by, TimeSpan timeout) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Timeout = timeout; return extendedBy; }
public static By OfAnyVisibility(this By by) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Visibility = ElementVisibility.Any; return extendedBy; }
public static By Invisible(this By by) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.Visibility = ElementVisibility.Invisible; return extendedBy; }
public static By Safely(this By by, bool isSafely = true) { ExtendedBy extendedBy = new ExtendedBy(by); extendedBy.Options.IsSafely = isSafely; return extendedBy; }