質問

I am testing a WPF application. One of my testcase involves opening 2 instances of my application and compare some elements. I can see that when I start each application instance, they have been numbered as 1 and 2.

var firstwindow= Sys.process("my App" ,1).WPFObject("HwndSource:AppWindow", WindowTitle).WPFObject("AppWindow", "WindowTitle", 1);

var secondwindow=Sys.process("my App" ,2).WPFObject("HwndSource:AppWindow", WindowTitle).WPFObject("AppWindow", "WindowTitle", 1);

So above are the two windows of my 2 application instances that I would want to compare.

Is there any other way of referring to these multiple instances windows?

Thanks.

役に立ちましたか?

解決

If the question is that you want to differentiate your processes not by their TestComplete ids, you need to find another way to distinguish them. For example, if the processes have some differences in their command line (e.g. parameters), you can get a process by its command line (c:\MyAppFolder\MyApp.exe -firstAppParameter):

var firstApp = Sys.FindChild("CommandLine", "*-firstAppParameter*");

If you are using Name Mapping, you can add the CommandLine parameter to the process mapping scheme and use the same approach with wildcards.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top