(c) seems perfectly reasonable. I'll implement that unless anyone has a strong opinion
Thanks! Hugh Sent from my iPad On Feb 14, 2012, at 12:18 PM, Jari Bakken <[email protected]> wrote: > > > On Tue, Feb 14, 2012 at 7:03 PM, Hugh McGowan <[email protected]> wrote: > We have a watir test that's now failing for 3.0 and I wanted to get your > thoughts if there was a better way to handle this. In order to pass watirspec > we changed watir to use #cssText to get the style. The problem is that we're > now only getting the inline style and not the internal style. > > # The element's style is defined inline - PASS > browser.form(:index, 1).style.should =~ /300px/ > > # This element's style is defined internal to the header - FAILS (you *can* > get the style from #ole_object.currentStyle.backgroundColor) > browser.div(:id => "Container").style.should =~ /#f00/ > > I tried this on webdriver and it's broken there too (no internal styles). Is > there a good way to handle this? Would CSS selectors be impacted (I've never > used them personally...) or is this that big of an issue? > > > The behaviour in watir-webdriver is this: > > Element#style() - return the "style" attribute of the element (i.e. "inline > style") > Element#style(property_name) - return the value of the named CSS property > from the computed style of the element (i.e. takes into account what is > inherited by parent nodes). > > Personally I don't see any use case where getting the full inline style > attribute as a string is useful - usually you know exactly what properties > you want to look at, and you want the actual, computed style. The reason > #style with no arguments behave this way, is for consistency with the other > attribute methods. > > Some options: > > (a) deprecate the no-args version of #style > (b) have #style return a Watir::Style object, that can be further used to > get CSS property values, but with a common API for watir and watir-webdriver > (i.e. not simply return the currentStyle OLE object) > (c) leave things as they are in watir-webdriver, but introduce the ability > to fetch a named property to Watir 3 through #style(property_name). > > I don't really have a strong opinion on this. > > Jari > _______________________________________________ > Wtr-development mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-development
_______________________________________________ Wtr-development mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-development
