Forum Discussion

VenkataRanga's avatar
VenkataRanga
Occasional Contributor
9 years ago

Have to verify the color of fields in the grid

Dear Friends,

 

In my application I have to verify the color of fields in the grid, it is a .net application. Could you please guide me how can I automate it.

 

Please find below image.

 

Warm Regards,

Venkata Ranga

4 Replies

    • tonydugay's avatar
      tonydugay
      Contributor
      If that doesn't help you you could try something like this code snippet (which is looking at a table cell in this case): var pict = theTable.cell.Picture(); Log.Picture(pict); var pixel = pict.Pixels(1, 1); Log.Message(pixel); return pixel; This will give you the colour of the pixel
      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        Hello,

         

        First, you need to learn what grid control is used in your application. You can check this in the ClassName or ClrClassName property in TestComplete’s Object Browser. After that, refer to the control’s documentation to learn a native method or a property that returns the desired value. You can call the found method from your TestComplete test.

         

        Another option is to analyze the "Get a control's background color" ( http://smartbear.com/viewarticle/9050/ ) How To article – it contains a script that returns the color of the control object. It should work for all controls. If you pass the path of your cell object to the function, it should return the background color of your cell.