Example #1
0
        public LambdAssert Exists(Func <WatiN.Core.Element, bool> check)
        {
            WatinElement ele = null;

            return(ConditionalDelay(
                       () => { return ((ele = ParentLAWW.Get(check)).Element != null); },
                       () => { ExistsNow(ele); }
                       ));
        }
Example #2
0
        public LambdAssert Exists(string selectorCode)
        {
            WatinElement ele = null;

            return(ConditionalDelay(
                       () => { return ((ele = ParentLAWW.Get(selectorCode)).Element != null); },
                       () => { ExistsNow(ele); }
                       ));
        }
Example #3
0
        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);
        }
Example #4
0
        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);
                    }
                });
            }
                       ));
        }
Example #5
0
        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);
        }
Example #6
0
        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));
        }
Example #7
0
 internal void SetElement(WatinElement ele)
 {
     ElementToSelectFrom = ele;
 }
Example #8
0
 protected LambdAssert ExistsNow(WatinElement ele)
 {
     return(NotEmptyNow(ele)
            .NotEmptyNow(ele.Element)
            .IsTrueNow(ele.Element.Exists));
 }