Ask a Question

Exists and Find Child Property didn't work

SOLVED
amit_2006
Occasional Contributor

Exists and Find Child Property didn't work

Dear Team,

Today suddenly i got below type mismatch issue in various screen while executing script .It was working fine last night and also working fine in other workstation today  without change . I really felt so bad because I am unable to figure out route cause and also same script worked well in last night  and other work station.I have reinstalled test complete 2-3 time but i didn't get answer why still happening this issue .

I tried to debug function and realized that it is giving error when 'Exists' method called .When i debug code line by line it is working fine but when i removed debug point then it is still giving same error .

Could you please help me on this?

Thanks you 

Amit

14 REPLIES 14
kevin_kapell
Frequent Contributor

Need to see the rest of the code.

How is the variable link mapped?

amit_2006
Occasional Contributor

Team,Thank you for giving quick response.Same script worked well in other workstation for same application but not mine workstation now .that same script worked well in last night but today i didn't change anything but getting type mismatch error. 

Function ClickDispTable_MenuItem(linkText)
Dim table,propArray, valArray,link
Set table = Sys.Process("Student").WinFormsObject("StudentMain").WinFormsObject("_WebBrowserHost").WinFormsObject("WebBrowser", "").WinFormsObject("Shell Embedding", "").Window("Shell DocObject View", "", 1).Window("Internet Explorer_Server", "", 1)_
.Page("ReleaseEnvironment").Frame("FrameMain1").Form("MainMenu")
propArray = Array("innerText","ObjectType")
valArray = Array(linkText,"Cell")
Set link = table.FindChild(propArray,valArray,1000) 'Visible , Enabled
 If ( link.Exists) Then 'getting error on this line without debug but worked well with debug point
 Call link.Click
End If
End Function

If it works with debug and not otherwise, it's probably a timing issue.  That's also likely since you're on a different machine.   

 

You'll want to use a Wait for the child object and then check for Exists.

https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-a...

 

 

NisHera
Valued Contributor

as per @Marsha_R could be a timing error.

to check you may add 

aqUtils.Delay(ms, Str)

just before "Set link... " ( just to confirm ...adding delays are not a good practice )

 

also in your code 

valArray = Array(linkText,"Cell")

linktext is not withing " " ....is it purposely?

 

and when you post some codes, write it as code, then it's easy to read & figure-out problems   

amit_2006
Occasional Contributor

 
 

Thank Team for giving valuable advice .next time i would mentioned as code as per below advice.

I have my pain point .I didn't change any code and gave to other team then they confirmed 2-3 times as working fine and also it was working fine same code last 2 days before.I am suddenly surprise why code is not working .

When i used wait method but some time it work but some time it is giving same error.When i used other property (isObject) then it is working without delay but I need to make so many changes from exists property to 'isObject(WinparentObj)

Please help me to understand why same code is working fine in other team workstation every time for running same application without any code changes but it is not working fine any time now and need to make so many changes from 'Exists' property to 'isObjects(WinparentObj)

Thank you for giving quick response always

Thanks Amit G

The tests always run well on the machine where they are developed because that's where they get fine tuned.  Most people have to adjust their tests even if just a little bit when they move to another machine.  Sometimes it happens like it did to you that you have to adjust more than a little.  The software can't possibly be written to handle all the combinations of machines that we have, but it will run well on most and we have to do a little work to keep it portable in our own labs.

 

There is one other thing you can try which is easier than changing a lot of code.  You can make a change in the Project Properties setting for Delay between events.  This slows down the test step by step so it's not running as fast as it possibly can and it allows a little more time for the objects to be detectable.  I would set it to a large number first so you can see it work and then back the number down so you're waiting long enough but not too long.

 

https://support.smartbear.com/testcomplete/docs/working-with/managing-projects/properties/playback.h...

amit_2006
Occasional Contributor

 

Till now i didn't get proper solution . I have followed all suggested steps and also given more delay in project property and also gave delay between two script.

I am unable to understand why i got this issue suddenly.I have developed script 15 -20 days before in mine workstation and it was working fine every day . but suddenly it is giving issue in morning when we are using 'exists ' and 'focus' related property only .some time it is not typing value in text box where it was read successfully with 'log.message d' method .Same script is working fine without any single line of code change where i didn't use that system to develop same script that was really shocking 

To avoid this issue , i need to use 'IsObject' property and typing to duplicate same script where it entered blank value in text box but it is so time consuming process for me but i don't have other solution.

Please help me if you have best solution where i don't need to change existing script more.

working fine :-

'To Put Synchronization point 
While not(IsObject(Sys.WaitProcess("Employees", 2000).WinFormsObject("Add employee").WinFormsObject("pnlAddemployee").WinFormsObject("Detailemployee")))
wend

Same Issue still exist :- 

While not(Sys.WaitProcess("Employees", 2000).WinFormsObject("Addemployee").WinFormsObject("pnlAddemployee").WinFormsObject("Detailemployee").Exists)

 

Thank you for putting effort to help me,

sonya_m
SmartBear Alumni (Retired)

Thanks everyone for helping here.

Hi @amit_2006 ! There's been a lot of suggestions in this thread. I think that contacting support directly is the best next step if you are still facing this. This definitely needs deeper investigation. The Community would be very thankful if you post the final solution in this thread.


Sonya Mihaljova
Community and Education Specialist

amit_2006
Occasional Contributor

Dear Team , I am getting this object identification issue again. I got route cause for this issue but I am unable to get solution .This issue occurred whenever windows version is updating .I am using Test complete 9 and getting same issue because windows version updated as latest version but same script is working in test complete 14 version . 

 

I don't know why TC/windows  version is creating issue for execution but Test Complete 14 able to execute same script but not test complete 9

 

I have only to use Test Complete 9 version for my script.

while using only Test complete 9 , Could any team help provide some solution how script working well with updated windows 10 latest version because I don't want to format my workstation and reinstall windows 10 with version 1803 . Your help is highly appreciated to reduce my pain a lot .

amit_2006_0-1615801171115.png

 

 

Thanks you

Amit Gupta

cancel
Showing results for 
Search instead for 
Did you mean: