尝试了每个列出的选项,但在使用白色的窗格控件中找不到功能区。尽管 VisualUIAVerify 将其显示在树中。
"window" "Test 0.0.1" "MainForm"
|--"pane" "Dock Top" "_MainForm_Toolbars_Dock_Area_Top"
|--"" "Ribbon" ""
|--"tab" "Ribbon Tabs" ""
|--"tab item" "Tools" ""
我想自动单击选项卡项“工具”。但只能找到一个“窗格”
import clr
import sys
sys.path.append(r"C:\TEMP\white")
clr.AddReference("White.Core")
clr.AddReference("White.NUnit")
from White.NUnit import *
from White import *
from White.Core import *
from White.Core.Configuration import *
from White.Core.UIItems import *
from White.Core.UIItems.WindowItems import *
from White.Core.UIItems.ListBoxItems import *
from White.Core.UIItems.Container import *
from White.Core.UIItems.Finders import *
from White.Core.Factory import *
from White.Core.Finder import *
from White.Core.AutomationElementSearch import *
from White.Core.WindowsAPI import *
from System.Diagnostics import Process
wp= Process();
wp.StartInfo.FileName = r"c:\TEMP\gui\TestShell.exe";
wp.StartInfo.Arguments = r"TestShell.taco -e DBA -s qa";
wp.Start();
wapp = Application.Attach( wp );
wnds=Application.GetWindows(wapp)
wnd=wnds[0]
#test
>wnd.Name
"Test 0.0.1"
我什至可以单击选项卡工具提供的坐标(IronPython)。
def click(cp,mouse,x,y):
cp = wnd.Bounds.TopLeft;
cp.Offset(x, y);
mouse = Desktop.Instance.Mouse;
mouse.Location = cp;
mouse.Click(cp);
cp = wnd.Bounds.TopLeft;
mouse = Desktop.Instance.Mouse;
mouse.Location = cp;
mouse.Click(cp);
click(cp,mouse,120,50) #tools
进入窗格:
pn=wnd.GetElement(SearchCriteria.ByAutomationId("_MainForm_Toolbars_Dock_Area_Top"));
系找丝带
rbn=pn.GetElement(SearchCriteria.ByAutomationId("Ribbon"));
或找到所有孩子
pn.FindAll(TreeScope.Children, Condition.TrueCondition)
似乎没有任何效果。