Forum Discussion

vijaynag's avatar
vijaynag
Occasional Contributor
10 years ago

how to check if an item is present in the Listview

I have a application which allows to create new users. I create a local variable and store the new userID that is created.



Once the new user window is closed, it comes to the home screen where there is a listview which shows all the users available.



Now I want to check if the UserID present in the variable is available in the listview.



I am using Compare Properties type checkpoint, but unable to figureout how exactly to achieve it.



This is a Win32 application and keyword tests.



any help highly appreciated! 

3 Replies

  • Ravik's avatar
    Ravik
    Super Contributor
    Hi Vijay,



    Try This it may help you-



    Function selectList(ddl_objName, objVal)

      Dim  item,icount ,ddlItemlist

      If ddl_objName.Enabled and ddl_objName.wItemCount >=1 Then

        ddlItemlist = ddl_objName.wItemList   

        If Instr(ddlItemlist,objVal)>1 then

          ddl_objName.ClickItem(objVal) 

         Else

          Log.Message "Item is not available in the list"

        End If

      End If

    End Function 





    Where   - ddl_objName is your object name and objVal is your expected value.



      
  • vijaynag's avatar
    vijaynag
    Occasional Contributor
    Thanks Ravi.



    Can this be achievable from the UI in anyways?
  • I think maybe what your looking for is Checkpoints - see http://support.smartbear.com/viewarticle/55270/



    You can setup checkpoints many different ways. Regions, Property, Object, Table, etc.

    The Region checkpoints grab a screenshot of a specific region, you can 'mask' areas of unimportance to your check, then have it record the resulting image. On playback, when it gets to the checkpoint, it takes new screenshots, and compares the required pieces and with the pixels and color variation to determine if the checkpoint passes or fails.



    For Object or property, it checks if the required field, value, etc. exists or does not exist and you get a fail or pass depending on your requirement.



    Hope this gives you another option for your testing.