Mobile testing - using css selector

how to verify the button color using css selector in katalon mobile testing…there is no keyword in katalon to verify color also css values not accepted ?

CSS selectors are accepted in Katalon. Your problem is two-fold:

  1. CSS style properties are not properties/attributes of the element, but, rather, properties of the style object which itself is a property of the element.

  2. The CSS style properties can change/evolve throughout the lifetime of the page. So the specified color could change due to interaction with the page itself.

The solution is to use JavaScript and dig out the current, live setting by using getComputedStyle().

On desktop, when the following JavaScript is placed in the developer console for this page (the one you are reading right now), it will return rgb(23, 121, 222)

getComputedStyle(document.querySelector("#ember6 header.d-header")).backgroundColor

To use that JavaScript code in Katalon (in Groovy) …

String js = 'return getComputedStyle(document.querySelector("#ember6 header.d-header")).backgroundColor;'
String bgColor = (String) WebUI.executeJavaScript(js, null)
println bgColor

While you can use WebUI on mobile, I’m not sure if WebUI.executeJavaScript is supported by mobile webdrivers – you will have to test it.

I see you also visited the page I was going to link you to! [mobile] Can't check color, font size
No idea whether there have been any developments in the years since that thread but this more recent answer on SO does not give confidence. If anyone knows an update, I’d be interested to hear. Seems pretty important to me.

thanks… webUI is not work for mobile testing i have checked this