Contributions
Why does object exist in Object Browser but not in test script while debugging
I'm debugging my test script, and break at a point where it checks if a window exists. I delay the script until the window exists: while(!Aliases["SwitcherProDT"]["WaitWinFormsObject"]("MainWnd", 0)["Exists"]) { aqUtils["Delay"](500); } Its not finding "MainWnd" even after it comes up. So I pause the script at this point. In my watch list I add: Aliases["SwitcherProDT"]["MainWnd"]["Exists"] and it shows the value as False. I check the Object Browser and it shows Exists as True. At first I thought it was a mapping issue 'cause in the browser it has it listed as: - Sys - ["Process"]("SwitcherProDT") -["Window"]("WindowsForms10.Window.8.app.0.33c0d9d", "SwitcherPro Desktop - TPS54611 6V to 0.9V @ 0.1A - 2188", 1) But, the properties for this "Window" as the mapped name listed as Aliases["SwitcherProDT"]["MainWnd"]. So, why does the browser sees that it exists but the script doesn't?16KViews0likes1CommentRe: Can't get TC to wait for app to become un-busy...
I also tried using the .NET process: < click design now button> dotNetProcess = dotNET["System_Diagnostics"]["Process"]["GetProcessById_2"](Sys["Process"]("SwitcherProDT").ProcessID); while(!dotNetProcess["Responding"]) { Log["Message"]("Waiting for switcherpro to respond..."); aqUtils["Delay"](500); } But this doesn't work either, it just skips right over this and continues on.1.8KViews0likes0CommentsCan't get TC to wait for app to become un-busy...
I have an application that I'm testing. I have TC click a button on the main window to open a new window that has an text input box and a button that when clicked creates a new design. At this point, the cursor turns to an hour glass. After the design is created, this design window goes away and I'm back to the main window. If there was an error with the text input, the design window stays up with the box highlited and the cursor back to a pointer. I repeat this process for different inputs to the text box. Now, the time it takes to create a design varies, so I can't just delay the test script 10 seconds, it has to be smarter. I thought TC would wait for an application to stop being busy before continuing on with the test, but it doesn't. It waits for a little bit, but then just continues even though the application is in a busy state. So I tried to force TC to wait. Here's what I've tried (C# script): <snip> // Bring up design window p1["MainWnd"]["WinFormsObject"]("DesignButton")["Click"](); w2 = p1["WinFormsObject"]("NewDesign"); // Click the design button. // TC should wait for the application to come out of a busy state after this button is clicked. w2["ButtonDesignNow"]["Click"](14, 17); // In case TC continued before the application became unbusy, force it to wait for design to be created. // Check if the design window is still up while(p1["WaitWinFormsObject"]("NewDesign", 0)["Exists"]) { // Check if the cursor is in a hourglass state if(aqString["Compare"](p1["NewDesign"]["Cursor"]["Current"]["ToString"]["OleValue"], "[Cursor: WaitCursor]", false) == 0) { // Still busy creating design, wait a bit Log["Message"]("Waiting for design to be created..."); aqUtils["Delay"](500); } else { // Done trying to create design, but design window is still up so there must be an error. Log["Error"]("Invalid input."); p1["WinFormsObject"]("NewDesign")["Close"](); } } <snip> The problem is that TC doesn't wait for the application to not be busy anymore. If the design creates within a couple of seconds, it works fine. But if it takes longer, I see in the playback info TC is waiting for "WinFormsObject NewDesign", then goes to waiting for "Application" object, then goes to waiting for "WinFormsObject MainWnd", then goes to trying to click DesignButton on the MainWnd. But I can see that the application is still busy and the NewDesign window is still up. How do I get TC to wait while the application is busy?19KViews0likes4Comments