Katalon extracting CSS value "background-color" sometimes in rgb(x,x,x) and sometimes in rgba(x,x,x,x)

Hello,

I am trying to verify that the colour of one page is equal to a particular colour. The problem I see is that when I run the tests in Katalon , it sometimes extract CSS value “background-color” in rgb(x,x,x) and sometimes in rgba(x,x,x,x) format. So my verification fails sometimes. Anyone knows what the problem is ? This is what I do.

String background_color=WebUI.getCSSValue(findTestObject(‘Object Repository/Caregiver/Team_Chat/Div_Internal_chat_area’), ‘background-color’)
WebUI.verifyEqual(background_color, ‘rgba(42, 79, 96, 1)’)

@jasmi_shaheer you can convert the color to Hex string so it does loose its alpha value

String hex = Color.fromString(background_color).asHex().toUpperCase();

If that should still return an alpha than the length is 8 and not only 6 so you can do
hex.reverse().take(6).reverse() so get only the RBG :wink:

Great. Thank you. I will try this out :slight_smile:

That worked. Thanks again :slight_smile: