Is there a way to initialize a shell IDispatchwrapper object inside a python script? Can I extend the class (no real need)? .
Code snippet:
def func(string):
shell_idispatcherwapper = <class>
If not isinstance(string, str):
return shell_idispatcherwapper
getAllChildren = Aliases.browser.page.tree.FindAllChildren('ObjectType','ListItem',2,True)
<more code>
shell_idispatcherwapper= getAllChildren
return shell_idispatcherwapper
def callFunction()
obj = function(someObject)
if not obj.Exists:
Log.Error("We failed")
Solved! Go to Solution.
The IDispatchWrapper that is in TestComplete is not a class or object that you can instantiate or do anything with. It's part of the applications methodology for identifying objects. So, if I'm understanding your question, then the answer is: there is no way to initialize the IDispatchwrapper shell object.
I'm not sure that there is a need for what you're trying to do. I mean, you're trying to find all list items within a particular tree getAllChildren is that list. I don't see any need for any other objects or classes. Can you explain better what you're trying to do?
I want to initialize IDispatchWrapper class at the start of a library function, before running any find command. If the call returns before the find creates the objects, I can rely on object.Exists property. Otherwise, I need to do sothing like this:
var = call the function
if hasattr(var,'Exists'):
if var.Exists == Flase:
exit()
else:
if var == False:
exit()
I'm confused... why do you need to Initialize IDispatchWrapper? As I said... there really is no need. Your "Find" call will do everything you need to find the objects.
Have you worked with flex?
I am building library functions for each flex object, which in term is called by other scripts. I need a way to pass a consistent object. To make matter worse, these objects are dynamic and reused.
Hi,
Hm-m-m... I am second to Robert and still not sure that I have a clear understanding of what you'd like to get...
Maybe more detailed example will help...
> objects are dynamic and reused.
Note, that if some object is destroyed and recreated in your tested application, the reference to the initial object in test code in TestComplete becomes invalid and cannot be 'refreshed'. You must search for a new object anew, even if all search criteria are the same.
For sure the exact test code implementation depends on your tested application, but as a rule globally kept references to objects from the tested application are not recommended because they can invalidate at any moment and the code that verifies reference validity and searches for the object anew adds unnecessary complexity. Usually it is faster and more convenient to search for the object where needed and dispose of the reference to the found object as soon as the operation over the object is completed.
I don't know how to or want to explaining further. I think my question is clear, the usage is irrelevant.
How can I initialize the IDispatchwrapper without searching for an object.
Sorry for my short reply, but sometimes the user want's to try things for them self.
The IDispatchWrapper that is in TestComplete is not a class or object that you can instantiate or do anything with. It's part of the applications methodology for identifying objects. So, if I'm understanding your question, then the answer is: there is no way to initialize the IDispatchwrapper shell object.
Subject | Author | Latest Post |
---|---|---|