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?
Yes, use the style method
Example:
require 'watir-webdriver'
b = Watir::Browser.start 'minesweeper.github.com'
puts b.div(:id => 'g1minesRemaining100s').style 'background-image'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With