How To Get Color of WebElement From Complicated css case using Webdriver?


Tags: java,css,webdriver,selenium-webdriver

Problem :

Im trying to check if color of some page is changing right when i click on button that should change the color of element inside that page, now what i need is to get value of rgb where is written rgb(183,168,168);, how can i access exactly this value in my case?

`.matrix-var1 .dmNav li a {
   box-shadow: 1px 1px 1px rgba(255, 255, 255, 0.5) inset, 2px 2px 2px rgba(0, 0, 0, 0.4);
   border-radius: 5px 5px 5px 5px;
   padding: 5px 0px;
   background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0%, rgba(0, 0, 0, 0.1)
   100%) repeat scroll 0% 0% rgb(183, 168, 168);`


Solution :

You can do so using the getCssValue() method.

So something like driver.findElement(By.id("id")).getCssValue("background-color");


    CSS Howto..

    Why do the images move when clicked in html and css? How to prevent it? [closed]

    how do i suppose to make the 4 box be responsive?

    How to Automatically adjust width in CSS so horizontal scrollbars would adjust automatically without taking so much space?

    How to load dynamic CSS files based on condition

    How to do CSS nth-child in span tags?

    How to make first page fullscreen and others not [closed]

    CSS/JQuery: A scrolling, overlay div and a centered layout - how to get it in a somewhat fixed position?

    CSS HTML : stumped on how to center this piece of text

    How to check if a particular CSS value exists

    How to change image size on featured images in wordpress?

    How can i get my slideshow to stop changing size?

    How to display image in sidebar-wrapper css class

    CSS, how to align a button vertically next to large images

    How to make background images clickable (javascript or css)

    how to disable one header among of multiple headers in jQuery table sorter

    How to get an image from a css animation keyframe to remain on the page after complete [duplicate]

    How to override display: table cell

    How can I convert to a CSS Drop down menu

    How to find elements and siblings within a tree

    how to create a css translateY on hover effect

    How do I make the box smaller in html?

    How to Change Text Color with CSS Transitions?

    How to modify CSS via JQuery

    How can I get this menu to hug the top of the page, widen out, and provide some space below it?

    How to add a border around a canvas?

    CSS-how to text-indent a nested unordered list

    CSS - how to style rounded area with a gradient background?

    How to fix a double click on a jQuery slide up/down animation?

    IBM Worklight - How to disable Native device features?

    How to set CSS attributes to default values for a specific element (or prevent inheritance)