Forum: Ruby on Rails Check for color

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bob S. (Guest)
on 2008-11-03 20:19
Does anyone know how to check to make sure that the text on a screen is
a certain color.

What I wish to do is check to make sure that the text color is red.

Any ideas??
Andrew V. (Guest)
on 2008-11-03 21:13
(Received via mailing list)
Can you give us more information about the goal?  I'd think you could
do a visual check of the page, or do some direct styling.

I haven't tried, but perhaps you can walk the DOM and check for
styling?
Bob S. (Guest)
on 2008-11-03 21:16
I am trying to create an auto test that will check some values on a page
and then also make sure that the text on some of the entries is in red
and other text in black. The text on the page will always be different
so I don't think checking all the HTML is the way to go.
Sheryl B. (Guest)
on 2008-11-03 23:48
(Received via mailing list)
I guess my next question would be:

Are you generating this page yourself or are you reading a page from
somewhere else?
Bob S. (Guest)
on 2008-11-04 15:07
This page is from an internal website for my company, so no I am not
generating it myself.
Hassan S. (Guest)
on 2008-11-04 18:06
(Received via mailing list)
On Mon, Nov 3, 2008 at 11:16 AM, Bob S.
<removed_email_address@domain.invalid> wrote:
>
> I am trying to create an auto test that will check some values on a page
> and then also make sure that the text on some of the entries is in red
> and other text in black.

Text is just character strings -- it doesn't have "colors" :-)

A User Agent /may/ display text with colors provided through style
sheets or style attributes in tags.

If you know in advance how the styling will be applied you might be
able to use WebTest; otherwise I'd suggest looking at a UA-based
tool like Selenium.

HTH!
--
Hassan S. ------------------------ removed_email_address@domain.invalid
This topic is locked and can not be replied to.