Solving ambiguous recognition of objects
Sometimes, Rational Functional Tester can't distinguish between two objects that are alike during playback. It's common for this to occur when two browsers or instances of the same application are open simultaneously. When two Web browsers are open, Rational Functional Tester tries to resolve the ambiguity by using an anchor to help determine the target object. Now that you know how to use the find method, you can identify the browser and application instances by using a TestObject reference.
Running more than one instance of an application simultaneously during playback will result in ambiguity about the target of commands, such as object() or click(). To resolve this, you can use ProcessTestObject when you call the startApp command. In the Listing 2 example, the ProcessTestObject functions as an anchor to locate the desired application.
Listing 2: Using the ProcessTestObject to anchor the application
ProcessTestObject pto1 = startApp("ApplicationOne");
ProcessTestObject pto2 = startApp("ApplicationTwo");
object(pto1, DEFAULT).click();
原帖由 xiaodouble 于 2007-12-13 22:32 发表
我在一台机器上同时启动两个以上一样的程序的时候,录制的脚本就会因为无法区别这两个窗口,而无法运行。所以我想通过获取到进程ID,然后再通过进程ID来或取到这两个程序的主窗体(testObject),上面的代码是尝试用f ...
原帖由 lovetest6 于 2007-12-14 14:35 发表
一般这样写应该可以达到你的要求:
ProcessTestObject pto1 = startApp("ApplicationOne");
ProcessTestObject pto2 = startApp("ApplicationTwo");
object(pto1, DEFAULT).click();
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |