Example #1
0
        public void Select(MethodContext ctxt, string selector)
        {
            var elements = new ElementsQuery(browser);

            ctxt.Elements(elements);

            elements.AddSelect(selector);
        }
Example #2
0
        public void WithText(MethodContext ctxt, string text)
        {
            var elements = ctxt.Elements();

            if (elements is null)
            {
                throw new InvalidOperationException();
            }

            elements.AddWithText(text);
        }
Example #3
0
        public void Visible(MethodContext ctxt)
        {
            var elements = ctxt.Elements();

            if (elements is null)
            {
                throw new InvalidOperationException();
            }

            elements.AddVisible();
        }
Example #4
0
        public void WithAttribute(MethodContext ctxt, string attributeName, string attributeValue)
        {
            var elements = ctxt.Elements();

            if (elements is null)
            {
                throw new InvalidOperationException();
            }

            elements.AddWithAttribute(attributeName, attributeValue);
        }
Example #5
0
        public void AssertExists(MethodContext ctxt)
        {
            var elements = ctxt.Elements();

            if (elements is null)
            {
                throw new InvalidOperationException();
            }

            if (!elements.Any())
            {
                throw new AssertionException("Elements not found.");
            }
        }
Example #6
0
        public void Click(MethodContext ctxt)
        {
            var elements = ctxt.Elements();

            if (elements is null)
            {
                throw new InvalidOperationException();
            }

            var first = elements.FirstOrDefault();

            if (first is null)
            {
                throw new AssertionException("No elements selected to click.");
            }

            first.Click();
        }
Example #7
0
        public void GetInnerText(MethodContext ctxt)
        {
            var elements = ctxt.Elements();

            if (elements is null)
            {
                throw new InvalidOperationException();
            }

            var first = elements.FirstOrDefault();

            if (first is null)
            {
                throw new AssertionException("No elements selected to get content from.");
            }

            ctxt.ChainValue = first.GetProperty("innerText");
        }
Example #8
0
        public void Type(MethodContext ctxt, string text)
        {
            var elements = ctxt.Elements();

            if (elements is null)
            {
                throw new InvalidOperationException();
            }

            var first = elements.FirstOrDefault();

            if (first is null)
            {
                throw new AssertionException("No element available to type into.");
            }

            first.SendKeys(text);
        }