Forum Discussion

JNugent's avatar
JNugent
Occasional Contributor
13 years ago

WaitWPFObject doesn't seem to work even though object can be identified.

Hi,

I can't seem to get the WaitWPFObject functionality working.



If I use the .Exists on the onject then this works correctly but the WaitWPFObject doesn't.

The object alias is:

cash.adminForm.VariableDefinitionForm.ResultSetForm.pnlMain.pnlResultSetEditor.resultSetEditor1.resultSetNameAndLocationEditor1.txtNewName



When i do the following this works:

Set resultSetName = cash.adminForm.VariableDefinitionForm.ResultSetForm.pnlMain.pnlResultSetEditor.resultSetEditor1.resultSetNameAndLocationEditor1.txtNewName

If resultSetName.Exists



...do something.

However when I try to use the Wait I can't seem to get it recognising the object:


If (cash.adminForm.VariableDefinitionForm.ResultSetForm.pnlMain.pnlResultSetEditor.resultSetEditor1.resultSetNameAndLocationEditor1.WaitWPFObject("txtNewName", 5000).Exists) Then


Can someone point out what I am doing wrong?



Thanks in advance!





3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    txtNewName is the name of the Alias, not necessarily the name of the object.  If you want to use the WaitWPFObject method, you need to know what the name of the object is in the application source code as per the help for the method:




    Name




    The name of the desired object as it is specified in the tested application’s source code (the string returned by the object’s native Name property defined in the NativeClrObjectnamespace).


    If the name is unavailable for some reason (for example, the application developers did not specify it), use the second implementation of the method to address the desired object.





    For the syntax that you're using and the name you have, replace WaitWPFObject with WaitAliasChild.  Everything else keep the same, just change the method type.



    For more information on WaitWPFObject, see http://smartbear.com/support/viewarticle/15957/



    For more on WaitAliasChild, see http://smartbear.com/support/viewarticle/12497/

  • Hi,


    Robert is right. Try using the following statement in your test:




    If (cash.adminForm.VariableDefinitionForm.ResultSetForm.pnlMain.pnlResultSetEditor.resultSetEditor1.resultSetNameAndLocationEditor1.WaitAliasChild("txtNewName", 5000).Exists) Then


    Also, I recommend that you read the Waiting for an Object, Process or Window Activation help topic.

  • JNugent's avatar
    JNugent
    Occasional Contributor
    Thanks Both, the WaitAliasChild worked perfectly.