Esempio n. 1
0
        static void Main(string[] args)
        {
            var xProcess = Retry.WhileException(() => Process.GetProcessesByName("AvaloniaTestApp").Single(), TimeSpan.FromSeconds(10));

            var xAuto = new OurAutomation();

            xAuto.Connect("http://localhost:5000/");
            var xApp = Application.Attach(xProcess);

            xApp.WaitWhileMainHandleIsMissing();

            var xProp = xAuto.PropertyLibrary.Element.Name;
            var xWin  = xApp.GetMainWindow(xAuto);

            Console.WriteLine("Window title: '{0}'", xWin.Title);
            var xButton = xWin.FindFirstDescendant(cf => cf.ByAutomationId("ourButton"));

            if (xButton == null)
            {
                Console.WriteLine("Button not found!");
            }
            else
            {
                Console.WriteLine("Button found!!");
            }
            xButton.Patterns.Invoke.Pattern.Invoke();
            //xButton.Click();
        }
 public WindowElement(WindowInfo info, OurAutomation automation) : base(automation)
 {
     mInfo = info;
     //
 }
 protected BaseElement(OurAutomation automation) : base(automation)
 {
 }
 public ControlElement(WindowInfo parentWindow, ConditionBase findCondition, AutomationElementInfo info, OurAutomation automation) : base(automation)
 {
     mInfo          = info ?? throw new ArgumentNullException(nameof(info));
     mParentWindow  = parentWindow ?? throw new ArgumentNullException(nameof(parentWindow));
     mFindCondition = findCondition ?? throw new ArgumentNullException(nameof(findCondition));
     Patterns       = new ControlElementPatterns(this);
 }