Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I view CSS styles that apply to an HTML element in watir-webdriver?

I am using watir-webdriver and am attempting to check the background-color of an HTML element. The problem is that the background-color is set in the CSS and not inside the HTML tag.

Is there a way to read the CSS value using watir-webdriver?

like image 919
juan2raid Avatar asked Jan 23 '12 23:01

juan2raid


1 Answers

Yes, use the style method

Example:

require 'watir-webdriver'
b = Watir::Browser.start 'minesweeper.github.com'
puts b.div(:id => 'g1minesRemaining100s').style 'background-image'
like image 56
Alister Scott Avatar answered Nov 15 '22 09:11

Alister Scott