internal override object getTarget(IInvocation invocation) { if (cached != null) { return(cached); } Type genericParameter = invocation.Method.DeclaringType.GetGenericArguments()[0]; IList result = GenericsUtility.CraeteInstanceOfSomeGeneric(typeof(List <>), genericParameter, new Type[] { }, new object[] { }) as IList; ITimeouts timeOuts = WebDriverUnpackUtility.UnpackWebdriver(locator.SearchContext).Manage().Timeouts(); try { timeOuts.ImplicitlyWait(zeroTimeSpan); waitingForElementList.Timeout = waitingTimeSpan.WaitingDuration; ReadOnlyCollection <IWebElement> found = waitingForElementList.Until(ReturnWaitingFunction(locator, bys)); result = convert(found, genericParameter); } catch (WebDriverTimeoutException ignored) {} finally { timeOuts.ImplicitlyWait(waitingTimeSpan.WaitingDuration); } if (shouldCache && cached == null) { cached = result; } return(result); }
internal override object getTarget(IInvocation ignored) { if (cached != null) { return(cached); } ITimeouts timeOuts = WebDriverUnpackUtility.UnpackWebdriver(locator.SearchContext).Manage().Timeouts(); try { timeOuts.ImplicitlyWait(zeroTimeSpan); waitingForElementList.Timeout = waitingTimeSpan.WaitingDuration; var result = waitingForElementList.Until(ReturnWaitingFunction(locator, bys))[0]; if (shouldCache && cached == null) { cached = result; } return(result); } catch (WebDriverTimeoutException e) { string bysString = ""; foreach (var by in bys) { bysString = bysString + by.ToString() + " "; } throw new NoSuchElementException("Couldn't locate an element by these strategies: " + bysString, e); } finally { timeOuts.ImplicitlyWait(waitingTimeSpan.WaitingDuration); } }
/// <summary> /// Sets the browser timeout to 1 minute when nothing is mentioned. /// </summary> /// <param name="span">Time out to wait for an element or operation</param> private void SetBrowserTimeOut(TimeSpan?span = null) { IOptions options = _webDriver?.Manage(); ITimeouts timeouts = options?.Timeouts(); if (timeouts != null) { TimeSpan waitAMinute = span ?? new TimeSpan(0, 1, 0); timeouts.ImplicitlyWait(waitAMinute); } }
public ITimeouts ImplicitlyWait(TimeSpan timeToWait) { return(_timeouts.ImplicitlyWait(timeToWait).ToWrapper()); }
public TimeoutsInstance ImplicitlyWait(int timeToWait) { return(new TimeoutsInstance(this.Engine.Object.InstancePrototype, m_timeouts.ImplicitlyWait(TimeSpan.FromMilliseconds(timeToWait)))); }