Forum Discussion

GordonD's avatar
GordonD
Occasional Contributor
6 years ago
Solved

ComboBox item selected ok but get an error anyway

I have a test with a ComboBox "ClickItem" operation to select a ComboBox item, with this description: "Selects the 4 item of the 'ComboBox' combo box". The 4th item is always selected correctly, but the operation fails anyway. After selecting the correct ComboBox item, TC says "Waiting for the ComboBox object" and times out. It then says, "The control does not exist", and it logs an error. It can select the correct ComboBox item by integer index or by name, but with the same resulting error.

The Test Visualizer image for this operation shows a blank combo box item instead of the actual item to be selected. Is this why it fails?  If so, how can I tell TC not to care if the Visualizer image doesn't match?  Or basically, how can I stop TC from failing this operation, since it succeeds in selecting the correct ComboBox item?

  • You can use Point and Fix in ObjectSpy to get the combo box.  Let's see what that shows.

  • GordonD's avatar
    GordonD
    6 years ago

    I solved this issue by using a script function (as suggested by Alex at Smartbear) to call the ComboBox's native method (SelectItemWithValue) instead of the TC method ClickItem that's added when recording the test.  I had trouble finding the ComboBox with ObjectSpy to use as the object path in the script, but I found it using Point and Fix as suggested by Martha (I marked it as the solution, since it was the closest).  That was necessary because the ComboBox only exists while the dropdown is open, and it closes when you click elsewhere, e.g. for the ObjectSpy drag.

     

    Alex explained that the TC ClickItem method, which I had used for the ComboBox item selection, first executes the click, then verifies that it went ok.  But the ComboBox disappears in the object tree as soon as the selection is made, so it hangs while trying to verify.

     

     

     

19 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Have you tried turning off the visualizer to make sure that that is, indeed, the problem?

  • GordonD's avatar
    GordonD
    Occasional Contributor

    I turned off visualizer data collection during recording and test runs, re-recorded the ComboBox test step, and it still fails the same way.  Now at least I understand the visualizer data collection doesn't affect test runs.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    After selecting the correct ComboBox item, TC says "Waiting for the ComboBox object" and times out.

    Can you provide the relevant part of code and specify what exactly line of code causes error record in the log? (Either double-click log error in the log or use Stack Trace log pane).

    The idea is that the combo-box is recreated after selected item changes and this invalidates the reference to the previous instance test code tries to use.

     

    • GordonD's avatar
      GordonD
      Occasional Contributor

      I attached a snapshot of the KeyWord test steps up to the ClickItem operation.  It shows the object path of the ComboBox.  After the test runs and the operation fails, if I click "Highlight" with the application still running, it says it can't display the object.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        The 4th item is always selected correctly, but the operation fails anyway. After selecting the correct ComboBox item, TC says "Waiting for the ComboBox object" and times out. It then says, "The control does not exist", and it logs an error. 

         

        How do you know that the 4th item is selected correctly?