public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var action = context.Action;
            var src    = context.FindElement(context.Target);
            var dst    = context.FindElement(context.Value);

            action.DragAndDrop(src, dst);
            action.Perform();
        }
예제 #2
0
        public static int GetActual(ITestContext context)
        {
            var element = context.FindElement(context.Target);
            var actual  = element.Size.Width;

            return(actual);
        }
예제 #3
0
        public static IEnumerable <string> GetActual(ITestContext context)
        {
            var element        = context.FindElement(context.Target);
            var selectElement  = new SelectElement(element);
            var optionElements = selectElement.AllSelectedOptions;

            return(optionElements.Select(i => i.GetAttribute("value")));
        }
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element = context.FindElement(context.Target);

            TestCommandHelper.AssertIsTrue(element.Selected);
        }
예제 #5
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var action = context.Action;

            action.ContextClick(context.FindElement(context.Target));
        }
예제 #6
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element = context.FindElement(context.Target);

            element.Click();
        }
예제 #7
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var expected = context.Target;
            var actual   = context.FindElement("body").Text;

            TestCommandHelper.AssertAreContains(expected, actual);
        }
예제 #8
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element = context.FindElement(context.Target);
            var action  = context.Action;

            action.MoveToElement(element);
            action.Perform();
        }
예제 #9
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element = context.FindElement(context.Target);
            var name    = context.Value;
            var value   = element.Selected.ToString().ToLower();

            context.Set(name, value);
        }
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element = context.FindElement(context.Target);
            var name    = context.Value;
            var value   = element.GetAttribute("value");

            context.Set(name, value);
        }
예제 #11
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element  = context.FindElement(context.Target);
            var expected = context.Value;
            var actual   = element.GetAttribute("value");

            TestCommandHelper.AssertAreEqual(expected, actual);
        }
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var attributeLocator = AttributeLocator.Parse(context.Target);
            var element          = context.FindElement(attributeLocator.ElementLocator);
            var attributeValue   = element.GetAttribute(attributeLocator.AttributeName);

            context.Set(context.Value, attributeValue);
        }
예제 #13
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element        = context.FindElement(context.Target);
            var action         = context.Action;
            Tuple <int, int> t = context.ParseCoordString(context.Value);

            action.MoveToElement(element);
            action.MoveByOffset(t.Item1, t.Item2);
            action.Click();
        }
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element       = context.FindElement(context.Target);
            var selectElement = new SelectElement(element);

            if (0 < selectElement.AllSelectedOptions.Count)
            {
                return;
            }

            TestCommandHelper.AssertFail();
        }
예제 #15
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var action = context.Action;
            var src    = context.FindElement(context.Target);

            string[] offset  = context.Value.Split(',');
            int      offsetX = Convert.ToInt16(offset[0]);
            int      offsetY = Convert.ToInt16(offset[1]);

            action.DragAndDropToOffset(src, offsetX, offsetY);
            action.Perform();
        }
예제 #16
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element = context.FindElement(context.Target);

            if (string.IsNullOrWhiteSpace(context.Value))
            {
                element.Clear();
            }
            else
            {
                element.SendKeys(context.Value);
            }
        }
        public static IEnumerable <string> GetActual(ITestContext context)
        {
            var element       = context.FindElement(context.Target);
            var selectElement = new SelectElement(element);
            var actualList    = new List <string>();

            for (int i = 0; i < selectElement.Options.Count(); i++)
            {
                var optionElement = selectElement.Options[i];

                if (optionElement.Selected)
                {
                    actualList.Add(i.ToString());
                }
            }

            return(actualList);
        }
        public static IEnumerable <string> GetActual(ITestContext context)
        {
            var           element       = context.FindElement(context.Target);
            var           selectElement = new SelectElement(element);
            List <string> actual        = new List <string>();

            for (int i = 0; i < selectElement.Options.Count; i++)
            {
                var optionElement = selectElement.Options[i];

                if ("true" == optionElement.GetAttribute("selected"))
                {
                    actual.Add(optionElement.Text);
                }
            }

            return(actual);
        }
        public static IEnumerable <string> GetActual(ITestContext context)
        {
            var element       = context.FindElement(context.Target);
            var selectElement = new SelectElement(element);

            List <string> actualList = new List <string>();

            for (int i = 0; i < selectElement.Options.Count; i++)
            {
                var optionElement = selectElement.Options[i];
                var selected      = optionElement.GetAttribute("selected");

                if (Convert.ToBoolean(selected))
                {
                    actualList.Add(optionElement.GetAttribute("id"));
                }
            }

            return(actualList);
        }
예제 #20
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element       = context.FindElement(context.Target);
            var selectElement = new SelectElement(element);

            foreach (var pair in dic)
            {
                if (context.Value.StartsWith(pair.Key, StringComparison.OrdinalIgnoreCase))
                {
                    string v = context.Value.Substring(pair.Key.Length);
                    pair.Value(selectElement, v);
                    return;
                }
            }

            ByLabel(selectElement, context.Value);
        }
예제 #21
0
        private static void ByElement(ITestContext context, string value)
        {
            var frameElement = context.FindElement(context.Target);

            context.Driver.SwitchTo().Frame(frameElement);
        }