In configuration page some colors are customizable.
I am trying to access the hex value of the preview color. After some reading, this is what I came up with:
(I have noticed that swatch value shows up as Hex in Chrome but as RGB in IE!)
var colorPrimary = page.QuerySelector(".evo-colorind"); var style = page.contentDocument.defaultView.getComputedStyle(colorPrimary, ""); Log.Message(style.background-color);
I am surprised that even the Smartbear support team is surprisingly quiet! Does this mean there is no way TestComplete can do this!!?
You are always there when I need help! I almost gave up hope. I will give it a try tomorrow and let you know.
As you suggested, I am using IE 11. Now I am getting runtime error:
var style = page.contentDocument.defaultView.getComputedStyle(colorPrimary, ""); Log.Message(style.background-color);I am not quite sure if I should be using
In the code that I'm using, I get the element from the page in IE... then I get the "currentStyle.backgroundColor" property. I think that's better than the getComputedStyle method. See if that works better for you.
var style = page.contentDocument.defaultView.currentStyle.backgroundColor(colorPrimary, "")
as you suggested.
I am getting:
backgroundColor is not a method, it's the actual property. So, just compare that property to the desired value.