예제 #1
0
        AutomationElement GetWindow(string LocValCal) //*******
        {
            UIAComWrapperHelper UIA = new UIAComWrapperHelper();

            List <object> AppWindows = UIA.GetListOfWindows();


            foreach (AutomationElement window in AppWindows)
            {
                string WindowTitle = UIA.GetWindowInfo(window);

                if (WindowTitle == null)
                {
                    WindowTitle = "";
                }
                Reporter.ToLog(eLogLevel.DEBUG, $"Method - {MethodBase.GetCurrentMethod().Name}, WindowTitle - {WindowTitle}");
                switch (LocateBy)
                {
                case eLocateBy.ByTitle:
                    if (WindowTitle.Contains(LocValCal))
                    {
                        return(window);
                    }
                    break;

                case eLocateBy.ByClassName:
                    if (window.Current.ClassName.Equals(LocValCal))
                    {
                        return(window);
                    }
                    break;
                }
            }
            return(null);
        }
예제 #2
0
        void RefreshActiveProcessesTitles()
        {
            UIAComWrapperHelper uiHelper = new UIAComWrapperHelper();

            uiHelper.mPlatform = GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib.ePlatformType.Windows;
            List <object> lstAppWindow = uiHelper.GetListOfWindows();

            ActiveProcessWindowsList.Clear();
            lstWindows.Clear();
            foreach (AutomationElement process in lstAppWindow)
            {
                // If the process appears on the Taskbar (if has a title)
                // print the information of the process
                if (!String.IsNullOrEmpty(process.Current.Name))
                {
                    ActiveProcessWindowsList.Add(process.Current.Name);
                    lstWindows.Add(process);
                }
            }
        }
예제 #3
0
        public void TestInitialize()
        {
            mGR = new GingerRunner();

            mBF            = new BusinessFlow();
            mBF.Activities = new ObservableList <Activity>();
            mBF.Name       = "BF UIAAutomationTest";
            Platform p = new Platform();

            p.PlatformType = ePlatformType.Windows;
            mBF.Platforms  = new ObservableList <Platform>();
            mBF.Platforms.Add(p);
            mBF.TargetApplications.Add(new TargetApplication()
            {
                AppName = "PBTestAPP"
            });
            Activity activity = new Activity();

            activity.TargetApplication = "PBTestApp";
            mBF.Activities.Add(activity);
            mBF.CurrentActivity = activity;

            mDriver = new WindowsDriver(mBF);
            mDriver.StartDriver();


            UIA = (UIAComWrapperHelper)mDriver.mUIAutomationHelper;

            mXPathHelper = ((IXPath)UIA).GetXPathHelper();

            //TODO: launch Win Forms Test App
            uiaForm.Show();
            List <object> list = UIA.GetListOfWindows();

            UIA.SwitchToWindow("FormEmbeddedBrowser");
            AppWindow = (AutomationElement)UIA.GetCurrentWindow();
        }