Skip to content
This repository

element.style without parameters doesn't return style info #120

Closed
alisterscott opened this Issue · 5 comments

2 participants

Alister Scott Jari Bakken
Alister Scott

Example script:

require 'watir-webdriver'
b = Watir::Browser.start 'minesweeper.github.com'
puts b.div(:id => 'g1minesRemaining100s').style 'background-image'
puts b.div(:id => 'g1minesRemaining100s').style #shouldn't be ''

Jari Bakken
Owner

Right. If you give an argument, we'll return the computed style of the element, otherwise, the style attribute (which may very well be empty).

I'm not entirely sure if it's correct to change this.

Alister Scott

I guess what I was looking for is all computed styles of the element. But, it makes sense to not change this method from what it actually currently does.
I imagine it may be rather inefficient to compute all styles of an element?

Jari Bakken
Owner

Honestly don't know if it's inefficient, but I think it will be pretty difficult to make the returned string consistent cross-browser.

What's the use case? What would you do with the full list?

Alister Scott

Someone wanted it on stackoverflow.
They couldn't work out how to use the style method, as it returned an empty string.
See: http://stackoverflow.com/questions/8979993/how-do-i-view-css-styles-that-apply-to-an-html-element-in-watir-webdriver

I'm more than happy to close it and see if it comes up as a request again :)

Jari Bakken
Owner

OK, then that's what we'll do :)

Jari Bakken jarib closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.