cancel
Showing results for 
Search instead for 
Did you mean: 

Exists and Find Child Property didn't work

SOLVED
Highlighted
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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

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

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

8 REPLIES 8
Highlighted
Frequent Contributor

Need to see the rest of the code.

How is the variable link mapped?

Highlighted
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

Highlighted
Community Hero

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...

 

 

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   

Highlighted
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

Highlighted
Community Hero

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...

Highlighted
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,

Highlighted
Community Manager

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

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!
Top Kudoed Authors