dadi
dadi

Reputation: 13

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

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);`

Upvotes: 1

Views: 1615

Answers (1)

Mark Rowlands
Mark Rowlands

Reputation: 5453

You can do so using the getCssValue() method.

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

Upvotes: 4

Related Questions