Ask a Question

when using waitchild method, got run time error, Type mismatch: 'TestObject.WaitChild'

SOLVED
StefanieYou
New Contributor

when using waitchild method, got run time error, Type mismatch: 'TestObject.WaitChild'

HI there,

 

I'm writing test cases in VB, and when using the method waitchild, got run time error, Type mismatch: 'TestObject.WaitChild' 

 

below is the script:

 

Sub Test39
set TestObject=Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly
If TestObject.WaitChild(lstbox_LandingSurface,15000) Then
  log.Message "the model browser is ready"
  call Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.txtBlock_LandingSurface.ClickR(30,10) 'choose landing surface node and edit feature
  Else
End if
End Sub

 

the parent object here is Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly, and the child is Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.txtBlock_LandingSurface

am I giving the wrong parameter?

 

thanks,

stefanie

6 REPLIES 6
Wamboo
Community Hero

Yo Stefanie!

 

The error "Type mismatch: 'TestObject.WaitChild" it is because the result of .WaitChild() its an object not true/false value (boolean)

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/waitch...

 

what you can do is to add .Exists in Your If condition to properly check the state of the object.

 

Example:

 

if(Aliases.Cube.CubeTransitionBox.WaitChild("WLbl_ValidationImage", 50000).Exists) {
// code
}

The result from .Exist method is a boolean value.

 

Hope this will help Yoy.

Hi Wamboo,

thanks for helping!

you're right! I re-edit the script but the still got an error

 

Sub Test39

TestObject=Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly
If TestObject.WaitChild(lstbox_LandingSurface,15000).Exists Then
log.Message "the model browser is ready"
call Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.txtBlock_LandingSurface.ClickR(30,10) 'choose landing surface node and edit feature
Else
End if
End Sub

error1.png

 

so I adjusted again:

Sub Test36
If Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.WaitChild(Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.lstbox_LandingSurface,15000).Exists Then
log.Message "the model browser is ready"
call Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.txtBlock_LandingSurface.ClickR(30,10) 'choose landing surface node and edit feature
Else
End if

End Sub

error2.png

 

then tried this again:

Sub Test37
If Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.WaitChild(lstbox_LandingSurface,15000).Exists Then
log.Message "the model browser is ready"
call Aliases.Inventor.AInventor.Pane_ModelBrowser.lst_Assembly.txtBlock_LandingSurface.ClickR(30,10) 'choose landing surface node and edit feature
Else
End if

End Sub

Can you try to use the method name, .WaitAliasChild instead of .WaitChild ?

 

check this topic for more information:

 

https://community.smartbear.com/t5/TestComplete-Functional-Web/WaitChild-method-syntax-and-how-does-...

tristaanogre
Esteemed Contributor

WaitChild requires two completely different sets of parameters than WaitAliasChild.  I think @Wamboo is correct here... you're using the wrong method.

 

But beyond that, your error on TestObject is probably due to being unable to find the object you're assigning to TestObject as well. You can't call "WaitChild" on an object that does not exist.  So, you may need to do additional tests for existance further up the tree.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

@tristaanogre @Wamboo it works when using waitAliasChild, thanks a lot!!

@tristaanogre I still have a question, what do you mean when you said "WaitChild requires two completely different sets of parameters"?

thanks,

stefanie

 

Sorry, my bad... I was thinking "FindChild"


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: