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

            try
            {
                IAlert alert = context.Driver.SwitchTo().Alert();
                context.Set(context.Target, bool.TrueString);
            }
            catch (NoAlertPresentException)
            {
                context.Set(context.Target, bool.FalseString);
            }
        }
        public static void ExecuteInternal(ITestContext context)
        {
            IJavaScriptExecutor js = (IJavaScriptExecutor)context.Driver;

            object result = js.ExecuteScript(context.Target);

            if (!string.IsNullOrWhiteSpace(context.Value))
            {
                if (null == result)
                {
                    context.Set(context.Value, string.Empty);
                }
                else
                {
                    context.Set(context.Value, result.ToString());
                }
            }
        }
Esempio n. 3
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            var element = context.FindElement("body");

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

            string name  = context.Value;
            string value = AssertElementHeightCommand.GetActual(context).ToString(CultureInfo.InvariantCulture);

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

            var name  = context.Value;
            var value = context.Target;

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

            string name  = context.Value;
            string value = AssertElementPositionLeftCommand.GetActual(context).ToString();

            context.Set(name, value);
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            IEnumerable <string> values = AssertSelectedLabelCommand.GetActual(context);
            var name  = context.Value;
            var value = string.Join(",", values);

            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);
        }
        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);
        }
        public static void ExecuteInternal(ITestContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }

            IAlert alert = context.Driver.SwitchTo().Alert();

            var name  = context.Target;
            var value = alert.Text;

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

            var cookie = context.Driver.Manage().Cookies.GetCookieNamed(context.Target);

            var name  = context.Target;
            var value = (cookie == null).ToString().ToLower();

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

            List <string> list    = new List <string>();
            var           cookies = context.Driver.Manage().Cookies;

            foreach (var cookie in cookies.AllCookies)
            {
                list.Add(cookie.ToString());
            }

            var name  = context.Target;
            var value = string.Join(";", list);

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

            var name  = context.Value;
            var value = true.ToString().ToLower();

            try
            {
                AssertElementPresentCommand.ExecuteInternal(context);
            }
            catch (TestAssertFailedException)
            {
                value = false.ToString().ToLower();
            }

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

            var name  = context.Target;
            var value = true.ToString().ToLower();

            try
            {
                IAlert alert = context.Driver.SwitchTo().Alert();
            }
            catch (NoAlertPresentException)
            {
                value = false.ToString().ToLower();
            }

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

            var cookie = context.Driver.Manage().Cookies.GetCookieNamed(context.Target);

            if (null == cookie)
            {
                throw new InvalidOperationException(string.Format(
                                                        CultureInfo.CurrentCulture,
                                                        Properties.Resources.NoSuchCookie,
                                                        context.Target));
            }

            var name  = context.Value;
            var value = cookie.Value;

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

            var macro = GetMacro(context.Target);
            var args  = GetArgs(context.Target);
            var name  = string.IsNullOrWhiteSpace(context.Value) ? "vba" : context.Value;

            switch (args.Count())
            {
            case 0:
                context.Set(name, App.Excel.Run(macro));
                break;

            case 1:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0)));
                break;

            case 2:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1)));
                break;

            case 3:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2)));
                break;

            case 4:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2),
                                args.ElementAt(3)));
                break;

            case 5:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2),
                                args.ElementAt(3),
                                args.ElementAt(4)));
                break;

            case 6:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2),
                                args.ElementAt(3),
                                args.ElementAt(4),
                                args.ElementAt(5)));
                break;

            case 7:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2),
                                args.ElementAt(3),
                                args.ElementAt(4),
                                args.ElementAt(5),
                                args.ElementAt(6)));
                break;

            case 8:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2),
                                args.ElementAt(3),
                                args.ElementAt(4),
                                args.ElementAt(5),
                                args.ElementAt(6),
                                args.ElementAt(7)));
                break;

            case 9:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2),
                                args.ElementAt(3),
                                args.ElementAt(4),
                                args.ElementAt(5),
                                args.ElementAt(6),
                                args.ElementAt(7),
                                args.ElementAt(8)));
                break;

            case 10:
                context.Set(name, App.Excel.Run(
                                macro,
                                args.ElementAt(0),
                                args.ElementAt(1),
                                args.ElementAt(2),
                                args.ElementAt(3),
                                args.ElementAt(4),
                                args.ElementAt(5),
                                args.ElementAt(6),
                                args.ElementAt(7),
                                args.ElementAt(8),
                                args.ElementAt(9)));
                break;
            }
        }