In the project that I'm testing, I need to wait for a WPF object that may not be available for several minutes as the system does its processing. If I use WaitWPFObject and set the timeout to more than about 30000 milliseconds, it will not wait the whole time.
The semi-solution that I have come accross is to put the WaitWPFObject call in a DO loop and check for it to exist and be visible on screen. The only problem with this is that if the WPF object doesn't exist, it will write an error to the log, which I don't want.
Is there any way to reference a WPF Object from WaitChild or Wait Window, or cause WaitWPFObject not to write an error to the log?
Wait...() functions should not post errors to the log if the object was not found as this is what they were designed for: try to get the reference to the object that may not exist.
Can you post here the code snippet that posts an error to the log?
Regards, /Alex [Community Hero] ____ [Community Heroes] are not employed by SmartBear Software but are just volunteers who have some experience with the tools by SmartBear Software and a desire to help others. Posts made by [Community Heroes] may differ from the official policies of SmartBear Software and should be treated as the own private opinion of their authors and under no circumstances as an official answer from SmartBear Software. The [Community Hero] signature is used with permission by SmartBear Software. https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame ================================
If I run the following code and it times out, it writes object not found errors to the logs. The screen that I'm waiting for takes a variable amount of time to pop up, depending on the system, so it's something that I need to loop a wait object for.
i = 0
Set w = setup.WPFObject("HwndSource: win_SubscriptionInfo", "Setup").WPFObject("win_SubscriptionInfo", "Setup", 1).WaitWPFObject("DocumentRoot", 45000)
i = i + 1
Loop Until (w.Exists And w.VisibleOnScreen) Or (i > 10)
Set grid = setup.WPFObject("HwndSource: win_SubscriptionInfo", "Setup").WPFObject("win_SubscriptionInfo", "Setup", 1).WPFObject("DocumentRoot")
The error seems to come from the line which follows the loop. You need to remove this line as you already have the target object at this point, and there's no need to obtain it again. Just check 'w.Exists' after your loop and use 'w' if it's True.
------ Yuri TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
I have the same problem with waitChild in a Java App. It does not always wait. Looking at what is inside waitChild, it is just a loop checking for child and then waiting. My suspicion is that wait drops through because it has in fact found the window (perhaps its not completely populated) but then other objects on that window are not yet found.
Strange thing is that sometimes, when I run the application once outside of test complete, it will then respond properly inside a playback script.