Ask a Question

Checking the background color of an object on my GUI application

SOLVED
betty1
Occasional Contributor

Checking the background color of an object on my GUI application

I am new to TestComplete and working with Keyword Tests to test my GUI application.  I want to see if a button on my screen is red, yellow, or green.  I can do a property checkpoint on each of the color properties (e.g. button is red):

 

Aliases.XXX_ShellView.ShellView.LayoutDocumentPaneControl.RXLed_C.Fill.GradientStops.zcollection.zlistStore.zentry0.Color, "B", 0, 0, True

Aliases.XXX_ShellView.ShellView.LayoutDocumentPaneControl.RXLed_C.Fill.GradientStops.zcollection.zlistStore.zentry0.Color, "G", 0, 0, True

Aliases.XXX_ShellView.ShellView.LayoutDocumentPaneControl.RXLed_C.Fill.GradientStops.zcollection.zlistStore.zentry0.Color, "R", 0, 255, True

 

But I don't see how to check the AND of those conditions.  Again, I am new to Keyword Tests, but there has to be a way to do this, right?

4 REPLIES 4
AlexKaras
Champion Level 2

Hi,

 

I am not sure that I got the question...

Are you looking for how to check that the button's background is red and green and yellow at the same time?

Anyway, I think that you should look at the Run Code Snippet keyword operation (or Run Script Routine one).

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
betty1
Occasional Contributor

I apologize for being unclear.  I am simply trying to detect the color of a button on my WPF GUI.  For example, if the following checkpoints all pass, the color is YELLOW (the ..X replaces the long object path)

 

Property Checkpoint 1

..X.RXLed_C.Fill.GradientStops.zcollection.zlistStore.zentry0.Color, "B", cmpEqual, 0.. 

 

Property Checkpoint 2:

..X.RXLed_C.Fill.GradientStops.zcollection.zlistStore.zentry0.Color, "G", cmpEqual, 255...

 

Property Checkpoint 3:

..X.RXLed_C.Fill.GradientStops.zcollection.zlistStore.zentry0.Color, "R", cmpEqual, 255.. 

 

These will each fail individually if they evaluate to False, but I was looking for a way to evaluate all 3 in the same step or better yet to get the 3 object properties and then I can manipulate them with an IF-Then.

I could not find a way to get those particular properties.  I am very new to TestComplete, so I just assumed there is an easier way and I haven't found it yet.  Thanks for the help.

TanyaYatskovska
SmartBear Alumni (Retired)

Hi @betty1,

Explore your control in the Object Browser - perhaps it provides a native property (like, Background color or Color) that you can call from script.

If this doesn't help, take a look at the following KB article:

https://smartbear-cc.force.com/portal/KbArticleViewer?name=Get-a-control-s-background-color&sp=testc...

 

Also, I've found several threads with a similar question:

https://community.smartbear.com/t5/TestComplete-General-Discussions/How-to-find-background-colour-of...

https://community.smartbear.com/t5/TestComplete-General-Discussions/Get-Object-Background-Color/td-p...

 

I hope it helps.

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



I am looking forward for something like this, and I don't have a native property in Object Browser. Has the article also a version for python? 

 

Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: