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();
        }
        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);
        }