Exemplo n.º 1
0
        private static void SelectByTextOrValueMultiple(this SelectList selectList, Constraint constraint)
        {
            // This is copied from SelectList.SelectMultiple
            var options = selectList.Options.Filter(constraint);
            if (options.Count == 0)
                throw new SelectListItemNotFoundException(constraint.ToString(), selectList);

            foreach (var option in options)
            {
                if (option.Selected) continue;
                option.SetAttributeValue("selected", "true");
            }

            selectList.FireEvent("onchange");
        }
        public Browser Find(Constraint findBy, int timeout, bool waitForComplete)
        {
        	Logger.LogAction((LogFunction log) => { log("Busy finding Internet Explorer matching constraint {0}", findBy); });

            var timer = new SimpleTimer(TimeSpan.FromSeconds(timeout));

            var ie = TryFindIe(findBy, timer);
            
            if (ie != null)
            {
                return FinishInitializationAndWaitForComplete(ie, timer, waitForComplete);
            }

            throw new BrowserNotFoundException("IE", findBy.ToString(), timeout);
        }
Exemplo n.º 3
0
        public Browser Find(Constraint findBy, int timeout, bool waitForComplete)
        {
            Logger.LogAction("Busy finding FireFox matching constraint {0}", findBy);

            var action = new TryFuncUntilTimeOut(TimeSpan.FromSeconds(timeout)) { SleepTime = TimeSpan.FromMilliseconds(500) };
            var fireFox = action.Try(() => FindFireFox(findBy));

            if (fireFox != null)
            {
                if (waitForComplete) fireFox.WaitForComplete();
                return fireFox;
            }

            throw new BrowserNotFoundException("FireFox", findBy.ToString(), timeout);
        }
Exemplo n.º 4
0
		private HtmlDialog FindHtmlDialog(Constraint findBy, int timeout)
		{
			Logger.LogAction("Busy finding HTMLDialog matching criteria: {0}", findBy);

            var action = new TryFuncUntilTimeOut(TimeSpan.FromSeconds(timeout))
            {
                SleepTime = TimeSpan.FromMilliseconds(500)
            };

            var result = action.Try(() => HtmlDialogs.First(findBy));
            
            if (result == null)
            {
                throw new HtmlDialogNotFoundException(findBy.ToString(), timeout);
            }
            
            return result;
		}