Object Background Color

Hi, I tried to get the background color of this object using getCSSValue to be used in verifyEqual so that it detects whether the background color is green or red. But the output color in print(CL) is rgba(250, 250, 250, 1) or white (should be green or red depending on the object status).

CL = WebUI.getCSSValue(findTestObject(Objects RepositoryStatus/PC Manual status’), ‘background-color’)

println(CL)

WebUI.verifyEqual(CL, ‘rgba(250, 0, 0)’)

//where CL = variable

what should i do to get the exact color?
Can anyone help?
Thank you!

Your Test Object

What does this test object actually select?

Does it select a <div> element with background-color: #FF0000 ?

I guess the test object actually selects a <span> element inside the <div>.

And the <span> element has background-color: rgba(250, 250, 250, 1);.

hi kazurayam,
this is the color for the

elements

and the test object i used in Findtestobject is pointed in the arrow below

Please show how the Test Object is defined.
Please show its locator (XPath or CSS Selector).

hi kazurayam, while in Object Spy, I tried to copy the selector of the element that is pointed by the arrow, pasted it in the Selected Locator in “CSS”. The code now detects the background color of the object (red or green). I’ll let you know if i encounter some other issues regarding in this “background color”.

13131313 1212

Thanks a lot!

I understand you have solved your problem. Congrat!

However I saw you locator is terribly long. A long locator tends to break easily when the design of your page is modified in future. Then your test will fail, and you would be forced to rewrite the locator. This is an advanced issue. It would be your future subject.

1 Like