Forum Discussion

shilpi_agarwal's avatar
shilpi_agarwal
Contributor
10 years ago

Result of aqObject.CheckProperty()

I am using an excel file as test data storage and compare popup message with expected value from excel file.

Following is the code snippet-

 

Call aqObject.CheckProperty(Aliases.prowin.dlgMessage.Static, "WndCaption", cmpEqual, Driver.Value(2), True)

prowin.dlgMessage.btnOK.ClickButton

loginMainWin.Close
prowin.wndProMainWin3.Close

 

When CheckProperty fails, any subsequent statements do not work, as a result application does not close and looks like hangs.

Is there anyway to return the result of CheckProperty method in some variable? or any other solution.

Please suggest.

3 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    I am questioning if using another method would provide different results, but it's worth a try I suppose?

    I believe you are using VBScript?

     

    Try this:

     

    Dim strCaption
    strCaption = Aliases.prowin.dlgMessage.Static.WndCaption
    
    If strCaption <> Driver.Value(2) Then
        Log.Warning("Property value " & strCaption & " does not match data value " & Driver.Value(2))
    End If
    prowin.dlgMessage.btnOK.ClickButton
    loginMainWin.Close
    prowin.wndProMainWin3.Close
    • shilpi_agarwal's avatar
      shilpi_agarwal
      Contributor

       

      I need to show whether a test is passed or failed. So I believe Either we can use property checkpoint or Log.Error method to show the error. In both case I am not able to close the popupbox and application after an error appears.

      Following is code:-

      strCaption = Aliases.prowin.dlgMessage.Static.WndCaption
      If strCaption <> Driver.Value(2) Then
      Log.Error("Property value " & strCaption & " does not match data value " & Driver.Value(2))

      End If
      prowin.dlgMessage.btnOK.ClickButton

      loginMainWin.Close
      prowin.wndProMainWin3.Close

       

      Please suggest

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Question: When you say the check fails, is there an error message? If so, what is it?

        My suspicion: The code seems to be fine. However, it is possible that the object that you are trying to get the WndCaption  property from might not exist in real time at the time you are making the check.  There may be a delay in when the object appears in which point you are trying to check the property of a non-existent object.  Try using a WaitAlias method in your code to retrieve your object and then do a check to see if the object exists before proceeding to the next part of your code.