Is it possible to identify the color of text?

Ask general questions here.
thirukumar
Posts: 8
Joined: Tue Jun 07, 2016 8:30 am

Is it possible to identify the color of text?

Post by thirukumar » Wed Jul 06, 2016 12:54 pm

Hi,

1. By Using Ranorex, Is it possible to identify the color of Text?
2. Is it possible to identify the background color of the Cell from Table?



Thanks,
Thirukumar.

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

Re: Is it possible to identify the color of text?

Post by odklizec » Wed Jul 06, 2016 1:06 pm

Hi,

The answer to both questions depends on the type of control in question and used technology ;) It's possible with some controls, but most probably not with all technologies.

Could you please upload a Ranorex snapshot (not screenshot) of the table/cell in question?
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

thirukumar
Posts: 8
Joined: Tue Jun 07, 2016 8:30 am

Re: Is it possible to identify the color of text?

Post by thirukumar » Mon Sep 19, 2016 7:35 am

Hi odklizec,

My Application is Java Based Window application.

I took small part of table. This is my Screen shot for your reference:
Table.jpg
Table
Table.jpg (39.44 KiB) Viewed 1023 times
Note: In this table there is a row with text red in color.

By using Spy, here is the snapshot for your reference:
Snapshot of Cell from a Table.7z
Snapshot
(4.16 MiB) Downloaded 57 times
Snapshot of Cell from a Table.7z


Kindly let me know how can i verify the text color here?

Thanks.

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

Re: Is it possible to identify the color of text?

Post by odklizec » Mon Sep 19, 2016 8:42 am

Hi,

Wow, that's quite a big snapshot! ;) Unfortunately, I'm not familiar with java-based apps and there seems to be no 'color' property visible in spy for the pointed element. However, it may still be possible to obtain the text color from code? I would suggest to start with these posts, where you can get some ideas how to obtain color value from a provided element:

http://www.ranorex.com/forum/does-not-m ... t8375.html
http://www.ranorex.com/forum/how-to-get ... t8017.html
http://www.ranorex.com/forum/can-access ... tml#p20593

As mentioned, I'm not familiar with java-based apps, so I'm not quite sure if any of the above posts are applicable to your problem, but I'm sure they are worth a try? ;)
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

thirukumar
Posts: 8
Joined: Tue Jun 07, 2016 8:30 am

Re: Is it possible to identify the color of text?

Post by thirukumar » Mon Sep 19, 2016 10:45 am

Hi odklizec,

I have gone through those 3 links. But I didn't find any answer for finding color of text.

If possible help me out with any workaround solution?

Thanks.

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

Re: Is it possible to identify the color of text?

Post by odklizec » Mon Sep 19, 2016 11:14 am

Hi,

Have you actually tried any of the sample codes from the link I posted? I think this one is closest to what you want?...
http://www.ranorex.com/forum/can-access ... tml#p20593
I just don't know if it's applicable to Java-based elements, but it's definitely worth a try? Just add the problematic element to repo and try the code. Either it returns the color or it fails? ;)
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

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Is it possible to identify the color of text?

Post by krstcs » Mon Sep 19, 2016 1:43 pm

I test a Java Swing-based application and I have found no way, in standard Java Swing and Ranorex, to get the text or background colors using Ranorex unless the developer specifically adds a property to the element that contains the color information that Ranorex can see. I don't know if this is a Ranorex limitation or a Java implementation issue. The first Ranorex might be able to do something about, the second, probably not so much.
Shortcuts usually aren't...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Is it possible to identify the color of text?

Post by Support Team » Tue Sep 20, 2016 2:42 pm

Hey,

might it be possible to upload a very short sample application, which holds just this table object?

Looking forward to hearing from you.

Sincerely,
Robert
.
Image

thirukumar
Posts: 8
Joined: Tue Jun 07, 2016 8:30 am

Re: Is it possible to identify the color of text?

Post by thirukumar » Wed Sep 21, 2016 6:24 am

Hi odklizec,

I went through the link "can-access-getstyle-from-ranorex-spy-but-not-studio-t4872.html#p20593". But here they used method called GetStyle(). Another thing they used is by using attribute value Color.

1) After Spying the Cell from the table - I don't have getstyle() method.
2) When you look into my Snap shot, there is no Property saying Color/Colour or ForeColor/ForegroundColor.

So i cant get the color of the text.


I agree with "krstcs" reply. He said clearly that After spying there is no particular property available for identifying the color of text (or) background color.


So any more ideas? Help me out please.

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

Re: Is it possible to identify the color of text?

Post by odklizec » Wed Sep 21, 2016 8:07 am

Hi,

It does not matter there is no color property available in the spy/snapshot. Some properties may not be visible in spy/snapshot, yet they may still be accessible via code! For example, I've never saw an html style in spy, but I know for a fact, it's possible to obtain the HTML text color style via the provided code. I just don't know if the code is applicable to Java elements as well? So try it with your app and appropriate repo element and you will quickly see if it works or not?

There may be another java-specific code, which can do what you want? Therefore, I would suggest to ask your dev guys to prepare a very simple "hello word" java app, with the grid and text as used in your main app and upload it here or send it to Ranorex support ([email protected],com). Ranorex folks can analyze it and eventually provide a solution for your problem. I'm afraid, there is no way around. Without working sample, there is probably nothing else we (Ranorex users like you) or Ranorex support can do for you.
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