Ejemplo n.º 1
0
        public virtual bool PerformAll(string[][] details, bool bypassIfNotPresented = false)
        {
            WaitUntilVisible();
            int length = details[0].Length;

            if (details[1].Length != length)
            {
                throw new ArgumentException("string[2][] details should contain two array of the same size!");
            }
            for (int i = 0; i < length; i++)
            {
                string     controlName = details[0][i];
                string     value       = details[1][i];
                IUIControl iuiControl  = ControlFromName(controlName);
                if (iuiControl == null || !iuiControl.WaitUntilVisible(bypassIfNotPresented ? 3000 : 10 * 1000))
                {
                    if (bypassIfNotPresented)
                    {
                        continue;
                    }
                    return(false);
                }

                try
                {
                    if (UIControl.AssureShowControlBeforeOperation && !iuiControl.Show())
                    {
                        Logger.W("{0} is still not displayed!", iuiControl);
                    }

                    iuiControl.Perform(value);
                    Logger.D("{0} => {1}", controlName, value);
                    Thread.Sleep(300);
                }
                catch (StaleElementReferenceException)
                {
                    Logger.W("StaleElement of {0}.", iuiControl);
                    UIControl.DiscardLastInstance();
                    iuiControl.Perform(value);
                }
                if (WaitPageReadyAfterPerforming)
                {
                    WebDriverManager.WaitPageReady();
                }
            }
            return(true);
        }