Ejemplo n.º 1
0
        public object Execute(IUIAutomationRunner runner)
        {
            AutomationElement element = UIAutomationHelper.FindWindowControl(this, ControlType.Button, this.TimeOut);

            if (element == null)
            {
                throw new NullReferenceException(string.Format("Button element with AutomationId '{0}' and Name '{1}' can not be find.",
                                                               element.Current.AutomationId, element.Current.Name));
            }

            ThreadStart start2             = null;
            IntPtr      nativeWindowHandle = (IntPtr)element.Current.NativeWindowHandle;

            if (nativeWindowHandle != IntPtr.Zero)
            {
                HandleRef hWnd = new HandleRef(nativeWindowHandle, nativeWindowHandle);
                PostMessage(hWnd, 0xf5, IntPtr.Zero, IntPtr.Zero);
            }
            else
            {
                if (start2 == null)
                {
                    start2 = delegate
                    {
                        PatternOperator.Invoke(element);
                    };
                }
                ThreadStart start = start2;
                new Thread(start).Start();
                Thread.Sleep(0xbb8);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public object Execute(IUIAutomationRunner action)
        {
            AutomationElement element = UIAutomationHelper.FindWindow(this, this.Timeout);

            //AssertionHelper.AssertWindowElementNotNull(context, element, this);
            if (base.WindowName != null)
            {
                //action.Runner.UIAutomation().AssertWindowStateByName(base.WindowName, WindowCurrentState.ReadyForInput, this.Timeout);
            }
            try
            {
                element.SetFocus();
            }
            catch (Exception exception)
            {
                // action.Logger.LogComment(string.Format("Could not set focus on window. {0}", exception.ToString()));
            }
            string keys = "";

            foreach (string str2 in this.Keys)
            {
                keys = keys + str2;
            }
            Thread.Sleep(200);
            if ((this.ContainsUnescapedKey(keys, '^') || this.ContainsUnescapedKey(keys, '%')) || this.ContainsUnescapedKey(keys, '+'))
            {
                keys = keys.ToLower();
            }
            System.Windows.Forms.SendKeys.SendWait(keys);
            Thread.Sleep(0x3e8);

            return(null);
        }
Ejemplo n.º 3
0
 public UIAutomationFacade(IUIAutomationRunner automationRunner)
 {
     if (null == automationRunner)
     {
         throw new ArgumentNullException("automationRunner is null.");
     }
     AutomationRunner = automationRunner;
 }
Ejemplo n.º 4
0
        public object Execute(IUIAutomationRunner action)
        {
            AutomationElement element = UIAutomationHelper.FindWindowControl(this, ControlType.MenuItem, this.TimeOut);

            if (element == null)
            {
                throw new NullReferenceException(string.Format("Menu element with AutomationId '{0}' and Name '{1}' can not be find.",
                                                               element.Current.AutomationId, element.Current.Name));
            }

            ThreadStart threadStart = delegate
            {
                PatternOperator.Invoke(element);
            };

            new Thread(threadStart).Start();
            Thread.Sleep(0xbb8);
            return(null);
        }
Ejemplo n.º 5
0
        public object Execute(IUIAutomationRunner runner)
        {
            AutomationElement element = null;

            if (IsFindByUser != true)
            {
                element = UIAutomationHelper.FindWindowControl(this, ControlType.Button, this.TimeOut);
            }
            else
            {
                element = targetElement;
            }

            if (element == null)
            {
                throw new NullReferenceException(string.Format("Element with AutomationId '{0}' and Name '{1}' can not be find.",
                                                               element.Current.AutomationId, element.Current.Name));
            }

            rect = element.Current.BoundingRectangle;

            if (IsSetPostion != true)
            {
                IncrementX = (int)(rect.Left + rect.Width / 2);
                IncrementY = (int)(rect.Top + rect.Height / 2);
            }
            else
            {
                IncrementX = (int)(rect.X + IncrementX);
                IncrementY = (int)(rect.Y + IncrementY);
            }
            //Make the cursor position to the element.
            SetCursorPos(IncrementX, IncrementY);
            Thread.Sleep(500);
            //Make the left mouse down and up.
            mouse_event(MOUSEEVENTF_RIGHTDOWN, IncrementX, IncrementY, 0, 0);
            mouse_event(MOUSEEVENTF_RIGHTUP, IncrementX, IncrementY, 0, 0);

            return(null);
        }
Ejemplo n.º 6
0
 public object Execute(IUIAutomationRunner action)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
 public static UIAutomationFacade UIAutomation(this IUIAutomationRunner runner)
 {
     return(new UIAutomationFacade(runner));
 }
Ejemplo n.º 8
0
 public object Execute(IUIAutomationRunner action)
 {
     action = new UIAutomationRunner();
     return(null);
 }
Ejemplo n.º 9
0
 public object Execute(IUIAutomationRunner automationRunner)
 {
     AutomationRunner.Execute(automationRunner);
     return(null);
 }
Ejemplo n.º 10
0
 public Tester(IUIAutomationRunner automationRunner)
 {
     AutomationRunner = automationRunner;
 }
Ejemplo n.º 11
0
 public Tester()
 {
     AutomationRunner = automationRunner;
 }
Ejemplo n.º 12
0
 public static NataiveMethodsFacade NativeMethods(this IUIAutomationRunner runner)
 {
     return(new NataiveMethodsFacade(runner));
 }