Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Return reusable object
#1
Not Solved
I am using QTP 11, and can't find a solution to using relative window locations that can vary in swfname values and number of SwfWindows. I am using an application that reuses windows within it, and am trying to use the With statement to reduce duplication. However, as the With statement can vary for each end window I tried to define the returned object in a function, but found that I could not set an object unless I knew the number of SwfWindows to be used.

Is there a way to do this? So far the only way I can get it to work is to define the cases for the With statement in every action and repeat the code under it as the with statement must have the End With in the case and not just be started in a case - meaning that I am not producing code that is easy to maintain. Is there another statement that is more flexible?

An example of the problem is:
Window z can be accessed from the child of window a, b, and from the child window of a and c, d, so the With statement could be:
Code:
With SwfWindow("swfname:=a").SwfWindow("swfname:=b").SwfWindow("swfname:=z")
or
With SwfWindow("swfname:=a").SwfWindow("swfname:=c").SwfWindow("swfname:=d").SwfWindow("swfname:=z")
So the code for click ok would only need to be defined once rather than repeated for every possible way of reaching the ok button:
.SwfButton("swfname:=btnOK").Click

Any help is appreciated as I am sure there must be an easier way to create maintainable code!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Childobject return wrong checkbox count.. VpnQTP 1 2,865 04-09-2015, 09:07 PM
Last Post: babu123
  Creating a folder from within a reusable action. sd3 2 3,186 06-18-2013, 03:20 PM
Last Post: learnQtptips
  SQL on oracle database doesn't return a value Bluefields 2 3,254 07-09-2012, 01:23 PM
Last Post: Bluefields
  VBScript - How to get the Function return value iamsekhar 2 22,752 09-13-2010, 04:16 PM
Last Post: lotos
  Reusable Actions created in 9.2 not recognized in 9.5 varsi 1 2,482 04-06-2010, 03:26 PM
Last Post: funajju

Forum Jump:


Users browsing this thread: 1 Guest(s)