cancel
Showing results for 
Search instead for 
Did you mean: 

Checking the background color of an object on my GUI application

Highlighted
New 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?

3 REPLIES 3
Highlighted
Community Hero

Re: Checking the background color of an object on my GUI application

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 Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
New Contributor

Re: Checking the background color of an object on my GUI application

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.

Highlighted
Community Manager

Re: Checking the background color of an object on my GUI application

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 Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors