Forum Discussion

sethlj11's avatar
sethlj11
New Contributor
11 years ago

New Window not found to click button

Hello,



I am a new user to TestComplete (I am using version 9.31). I am attempting to automate the installation of my company's product. So far, I can copy the installer (it's an .exe, not an .msi) from the original network location to a local one. I can also start the installer and can click a few buttons.



The problem starts when the installer tries to verify the installation of some C++ and C# redistributables. If the system detects you already have them installed, that installation fails - this is a known bug with our installer, but I am attempting to write the test to include this bug. This will prompt a new message box to appear and ask if you want to continue the installation of the product; it's at this point that the user should click the Yes button.



I used the Record Test feature to create the test. However, when I go to play the test back, the Yes button is never clicked. Specifically, the "object does not exist" error was listed in the log.



I already tried to find a workaround. First, I added a delay to make sure the window was created before the button went to be clicked - no go. Then, I I went to the Object Browser and found that when the window is created, the object browser wasn't updating. I believe this to be the problem - the window may be created, but the object hierarchy isn't being updated. When I pause the test and use the Object Spy tool on the new window, the object browser updates with the new window, but the names of the windows change.



Am I doing something wrong, or is this a possible bug with the software? Are there other possible workarounds known to get past this issue? Thanks. 

5 Replies

  • sethlj11's avatar
    sethlj11
    New Contributor
    Update:



    I added a WaitWindow operation on the main process, looking for the popup window. The window is still not being recognized as created, even after waiting a full minute. If I put a breakpoint on the button click operation, and manually refresh the object browser, the window pops up as being created, then I'll continue the test, but the window still isn't being found by the test.
  • sethlj11's avatar
    sethlj11
    New Contributor
    Update:



    I checked the object browser again. It turns out that the main installation window is mapped to a specific name with an instance number of 1, and when I refresh the object browser, its instance number becomes 2. The pop up window, which is actually mapped to the same name (Alias["Setup"]["dlgSetupInstallShieldWizard"]), has the instance number of 1. Both windows are populated with the correct controls in the object browser.



    I also tried adding a manual delay of 20 seconds, then clicking on a specific spot on the screen. The test ended with an error that said the spot couldn't be clicked because a window (the pop up for the install, the one causing the problem in the first place) was in the way. At this point I almost screamed.
  • sethlj11's avatar
    sethlj11
    New Contributor
    This must be the problem.



    The name mapping confused me, so I decided to manually rebuild them. Then I realized what my last post meant - that the hierarchy of objects was updating, and the mappings weren't going along with it anymore, thus invalidating the previous hierarchy.



    What I'm still not sure of is if the hierarchy update is a bug with TC and how it tracks objects, or if this is an installer bug where it incorrectly updates the window instances. I'll continue to check more on my end... does anyone know more about this?



  • I encountered a similar problem and I found it unresolvable:

    My app is calling a FileOpen dialog from the OS (Windows7) and I want to specify a file name that isn't yet existing. Consequently the system prompts me saying the file doesn't exist and asking whether it should create it.

    TC properly records the click on the Yes-Button, but when replaying the test, it will not find the object because both the FileOpen dialog and then Confirm dialog are identified by the respective window's caption, which in both cases is 'Open'. As a result, the Confirm dialog is virtually inaccessible by TC.



    My pragmatic resolution was to make sure that the file to be specified does not yet exist, so I could safely expect the confirmation dialog to occur. Then I send a Sys.Keys('[Enter]') statement to click the default button (which is 'Yes').



    Not really what I wanted, but it works for my test at last.

    Seems your problem could be identical to this.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Seth,


     


    Typically, installers create several processes. So, creating tests for them is quite a difficult process. However, here are some tips that may help you:


     - When the installation starts, there are several processes having the same name, and the process taken by TestComplete may not contain the needed window. 


    To avoid this problem, you can modify the NameMapping scheme and specify the required children for the needed process. See http://support.smartbear.com/viewarticle/30311/ for details.


      - You need to avoid using the Index property to map the installation's main form, and add the Visible property equal to True to the mapping criteria. Please note that the value of the Caption property for the main form can change. You can use wildcards to make your NameMapping scheme more reliable.