Need to convert hexadecimal color code to user understandable color code

324 views
Skip to first unread message

Prateek Agarwal

unread,
Oct 18, 2012, 11:54:19 PM10/18/12
to seleniu...@googlegroups.com

Hi all,
 
I need te java code to convert hexadecimal color code to user understandable color code through selenium webdriver.
I have used :
 
 
String BackColor = driver.findElement(By.cssSelector("input[name=\"EmployerId\"]")).getCssValue("background-color");
System.out.println("Background color of the Element is : " + BackColor );

 

It is giving me result as : #ffffff

But it is not easy to understand which code is this.

I need to have the code by which I can able to know, that it is either Yellow color or Pink color. 

Please help me ..


 

simon qiu

unread,
Oct 19, 2012, 12:47:12 AM10/19/12
to seleniu...@googlegroups.com
You may use Color class from awt package to make compare between the  hexadecimal color code  and the general color which Color class has defined.

2012/10/19 Prateek Agarwal <prateek....@gmail.com>

Please help me ..


 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/dqOVnssRhdUJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Simon Qiu

Prateek Agarwal

unread,
Oct 19, 2012, 1:19:05 AM10/19/12
to seleniu...@googlegroups.com
Thanks for the reply..
 
Can you please post the code ..

Mark Collin

unread,
Oct 19, 2012, 1:20:52 AM10/19/12
to seleniu...@googlegroups.com

koleka...@gmail.com

unread,
Dec 12, 2013, 1:09:25 AM12/12/13
to seleniu...@googlegroups.com
 String cl = driver.findElement(By.id("gbqfba")).getCssValue("background-color");
                      System.out.println("colour of the button is : "+ cl);

koleka...@gmail.com

unread,
Dec 12, 2013, 1:09:41 AM12/12/13
to seleniu...@googlegroups.com

David

unread,
Dec 12, 2013, 8:35:20 PM12/12/13
to seleniu...@googlegroups.com
For the mentions on Java color class, is there a cross language solution to the question? It would be nice to have a generic approach to implement across any language binding. Of course, it can be done for each, but hopefully it's not highly language/platform specific to implement. Easier for Selenium end users.
Reply all
Reply to author
Forward
0 new messages