How to read color

Best practices, code snippets for common functionality, examples, and guidelines.
IvanT
Posts: 43
Joined: Wed Feb 06, 2019 8:00 pm

How to read color

Post by IvanT » Sun Nov 29, 2020 9:56 pm

In snapshot i have a lot of colors, but i can't read them. May be ranorex has some plugin to read it?
Attachments
Colors.rxsnp
(18.9 KiB) Downloaded 21 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6529
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to read color

Post by odklizec » Mon Nov 30, 2020 7:19 am

Hi,

I'm afraid, you are out of luck here. Apparently, this kind of system color panel is not accessible by Ranorex Spy or any other UI spy tool.
Colors.png
Colors.png (181.42 KiB) Viewed 184 times
You will get the same result from MS Inspect, which means that this UI element is apparently not implemented with accessibility on mind. So no, you can't get the individual colors by Ranorex tools. The only thing you may probably do is to use image-based automation eventually, implement your own color reading method via C#?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Stub
Posts: 439
Joined: Fri Jul 15, 2016 1:35 pm

Re: How to read color

Post by Stub » Mon Dec 07, 2020 9:29 am

That last is what I've had to do for some stuff in our AUT. I grab a bitmap of the element and study the pixel colour at the centre, or something along those lines. Has worked reliably for us for years now.