Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a way to create dynamic objects by declaring the type of object as parameter
#1
Solved: 7 Years, 1 Month, 2 Weeks ago Question 
Hey guys, need some ideas about creating dynamic functions and objects which could be used across different platforms, e.g. web, java, windows, etc...
Below is an example of what I am trying to achieve (not even sure this would be possible). So for e.g. I have a check function which in case = true then reports Pass, otherwise reports Fail.
Code:
Public Sub ObjByTitle_Exist(objType, objTitle)
    Set objDesc = Description.Create  
    objDesc("micclass").value = objType
    objDesc("title").value = (objTitle & ".*")


    If objType(objDesc).Exist(5) Then
        ''' Report Pass
    Else
        ''' Report Fail
    End If
End Sub


The intention of such a thing is to be used across different platforms where when using it I just throw in the object type and the system will identify it and do whatever is needed or possible with that specific object.

Then I am looking to use it in this way:
Code:
'in Java:
ObjByTitle_Exist "JavaDialog", "DialogTitle"

'in Windows:
ObjByTitle_Exist "SwfDialog", "DialogTitle"

Another example would be for e.g. I have an SwfButton and a WebButton - no I am trying to access any of those buttons by using a function like the one above - I could create 2 different function for each object type, but this would extend the framework way too much. Any ideas if kind of a combined framework could be created or one to be used across multiple environments would be great?!
Reply


Messages In This Thread
Is there a way to create dynamic objects by declaring the type of object as parameter - by lotos - 10-11-2017, 02:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help in creating dynamic object string using Childobjects Keshub Mathur 0 1,608 09-11-2017, 05:52 PM
Last Post: Keshub Mathur
  Optional parameter in function amit25007 6 5,427 01-06-2016, 03:29 PM
Last Post: venkatesh9032
  How to make a function for an object that has a large number of parent objects Shroomsday 1 2,399 01-28-2014, 11:15 PM
Last Post: jacosta
Sad QTP Script | how to get object of some open window just using its class type,Java sophia.sabir 1 8,867 08-07-2013, 01:26 PM
Last Post: anil2u
  impossible to pass a parameter of type 64 bytes in a webservices dosreis 0 2,168 06-21-2013, 01:55 AM
Last Post: dosreis

Forum Jump:


Users browsing this thread: 3 Guest(s)