public LambdAssert Exists(Func <WatiN.Core.Element, bool> check) { WatinElement ele = null; return(ConditionalDelay( () => { return ((ele = ParentLAWW.Get(check)).Element != null); }, () => { ExistsNow(ele); } )); }
public LambdAssert Exists(string selectorCode) { WatinElement ele = null; return(ConditionalDelay( () => { return ((ele = ParentLAWW.Get(selectorCode)).Element != null); }, () => { ExistsNow(ele); } )); }
public LambdAssert GetFrom(WatinElement ele) { if (ParentLAWW == null) { throw new ApplicationException("Cannot use GetFrom() without using LambdAssertableWithWatin and implementing a call to its CTOR"); } ParentLAWW.ClearCache(); ParentLAWW.SetElement(ele); return(this); }
public LambdAssert HasText(string text) { WatinElement el = null; return(ConditionalDelay( () => { return (el = ParentLAWW.Get()).HasText(text); }, () => { ExecuteAssert(() => { if (!el.CleanText.ToLower().Contains(text.ToLower())) { Assert.Fail("Expected context to contain string: {0}", text); } }); } )); }
private WatinElement SetInCache(string selector, WatinElement ele) { if (ele == null || ele.Element == null) { if (ThrowOnFailedGet) { throw new ApplicationException("Get failed for selector '" + selector + "', could not find element for assertion."); } return(new WatinElement(null, this));; } if (ElementCache.ContainsKey(selector)) { ElementCache[selector] = ele; } else { ElementCache.Add(selector, ele); } return(ele); }
public LambdAssert GetFrom(string selectorCode) { //Technically we clear the cache twice, but it has to be done before we call Get below ParentLAWW.ClearCache(); GetFrom(); //Bug fix -- clear before setting so we're not limited to calling GetFrom() on things inside the current GetFrom() call. DontThrow(); WatinElement ele = ParentLAWW.Get(selectorCode); Wait(() => (ele = ParentLAWW.Get(selectorCode)).Element != null && ele.Element.Exists); MaybeThrow(); if (ele.Element == null) { throw new ApplicationException("Could not GetFrom '" + selectorCode + "', element was not found despite waiting."); } LastGetFromSelector = selectorCode; return(GetFrom(ele)); }
internal void SetElement(WatinElement ele) { ElementToSelectFrom = ele; }
protected LambdAssert ExistsNow(WatinElement ele) { return(NotEmptyNow(ele) .NotEmptyNow(ele.Element) .IsTrueNow(ele.Element.Exists)); }