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?
Solved! Go to Solution.
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).
/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.
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.
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:
Also, I've found several threads with a similar question:
I hope it helps.
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?