Exemplo n.º 1
0
        public AutomationElement[] GetChatListElements()
        {
            MainWindow.SetForeground();
            MainWindow.WaitUntilClickable();

            var chatButton = MainWindow.FindFirstDescendant("聊天", ControlType.Button).AsButton();

            if (chatButton == null)
            {
                throw new Exception("Could not find chat button.");
            }

#if false
            chatButton.DrawHighlight();
            chatButton.Invoke(); // Doesn't work for me.
#else
            chatButton.LeftClick();
#endif

            var chatList = FlaUIHelper.WaitForElement(
                () => MainWindow.FindFirstDescendant("会话", ControlType.List));
            if (chatList == null)
            {
                throw new Exception("Could not find chat list.");
            }

            chatList.DrawHighlight();

            return(chatList.FindAllChildren());
        }
Exemplo n.º 2
0
        public override void StartDriver()
        {
            switch (LibraryType)
            {
            case eUIALibraryType.ComWrapper:
                mUIAutomationHelper = new UIAComWrapperHelper();
                ((UIAComWrapperHelper)mUIAutomationHelper).WindowExplorer = this;
                ((UIAComWrapperHelper)mUIAutomationHelper).BusinessFlow   = BusinessFlow;
                ((UIAComWrapperHelper)mUIAutomationHelper).mPlatform      = UIAComWrapperHelper.ePlatform.PowerBuilder;
                break;

            case eUIALibraryType.FlaUI:
                mUIAutomationHelper = new FlaUIHelper();
                ((FlaUIHelper)mUIAutomationHelper).WindowExplorer = this;
                ((FlaUIHelper)mUIAutomationHelper).BusinessFlow   = BusinessFlow;
                ((FlaUIHelper)mUIAutomationHelper).mPlatform      = UIAutomationHelperBase.ePlatform.PowerBuilder;
                break;
            }
        }
Exemplo n.º 3
0
        public Tuple <AutomationElement, AutomationElement>[] GetGroupMemberElements(AutomationElement group)
        {
            group.LeftClick();

            var groupPane = FlaUIHelper.WaitForElement(
                () => MainWindow.FindFirstByXPath("/Pane[2]/Pane[2]/Pane[3]/Pane/Pane/Pane/Pane"));

            if (groupPane == null)
            {
                throw new Exception("Could not find group pane.");
            }

            groupPane.DrawHighlight();

            var groupInformationButton = groupPane.FindFirstDescendant("聊天信息", ControlType.Button);

            if (groupInformationButton == null)
            {
                throw new Exception("Could not find group information button.");
            }

            groupInformationButton.LeftClick();

            var groupInformationWindow = FlaUIHelper.WaitForElement(
                () => MainWindow.FindFirstChild("聊天信息", ControlType.Window));

            if (groupInformationWindow == null)
            {
                throw new Exception("Could not find group information window.");
            }

            groupInformationWindow.DrawHighlight();

            var showMoreGroupMembersButton = groupInformationWindow.FindFirstDescendant(
                "查看更多群成员", ControlType.Button);

            if (showMoreGroupMembersButton != null)
            {
                showMoreGroupMembersButton.LeftClick();
            }

            var memberList = FlaUIHelper.WaitForElement(
                () => groupInformationWindow.FindFirstDescendant("聊天成员", ControlType.List));

            if (memberList == null)
            {
                throw new Exception("Could not find member list.");
            }

            memberList.DrawHighlight();

            var groupMemberElements = memberList.FindAllDescendants(
                conditionFactory => conditionFactory.ByControlType(ControlType.Button));

            return(groupMemberElements
                   .Where((e, i) => i % 2 == 0)
                   .Zip(
                       groupMemberElements.Where((e, i) => i % 2 != 0),
                       (a, b) => Tuple.Create(a, b)
                       )
                   .Where((member, i) => !IsAddOrDeleteButton(member, i))
                   .ToArray());
        }