Identify cell/Row color from table.

Ask general questions here.
akshayru
Posts: 4
Joined: Thu Jan 18, 2018 10:23 pm

Identify cell/Row color from table.

Post by akshayru » Wed Feb 14, 2018 8:29 pm

I am trying to identify color of cell, every row in my table have different color and based on its color we identify its type. I tried spy but i don't see any property which shows color. I have attached xpath, could you please guild me if there is any way...

Snapshot Location (As its more than 1MB i was unable to upload) - https://drive.google.com/open?id=1WRDlh ... ZSkEwCAx6y

XPath - /form[@name='com.actual_systems.p2.client.GUI.partsearch.foundparts.FoundParts:0']//container[@accessiblename='Found Parts']/?/?/container[@name='scrollPane']/container[1]/table[@name='foundPartsTable']/row[@index='7']

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

Re: Identify cell/Row color from table.

Post by odklizec » Thu Feb 15, 2018 8:32 am

Hi,

Unfortunately, the snapshot you posted shows no background color, so it's hard to suggest something reliable how to get it. But it may not mean the background color cannot be obtained from the row/cell in your app? My guess is that you need to use cell and not entire row. I would suggest to start with this post, where you can find some suggestions, how to get a background/foreground/text color from an app...
https://www.ranorex.com/forum/post40070.html?#p40070

If you need some more help, I think there is not much anyone here can do without functional sample app (simple hello world with table filled with some mock data and set background color, as in your AUT).
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: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: Identify cell/Row color from table.

Post by Stub » Thu Feb 15, 2018 11:32 am

In our app using legacy Windows controls I recall that I had to retrieve an image of the area on the table and sample the colour at a particular pixel (typically in a corner).

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

Re: Identify cell/Row color from table.

Post by odklizec » Thu Feb 15, 2018 12:45 pm

This may be another possibility but I think there should be a "normal" way for Java swing-based apps, e.g. using GetStyle method or similar? I would definitely try this way before meddling with pixels ;)
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