On Feb 22, 1:52 pm, Željko Filipin <[email protected]> wrote: > On Wed, Feb 22, 2012 at 3:45 PM, Jamison Dance <[email protected]> wrote: > > Is there any way to capture the current state of an element? > > Sure, try this: > > browser.element.html > > I think both watir and watir-webdriver gems support attribute_value, too: > > http://rubydoc.info/gems/watir-webdriver/Watir/Element#attribute_valu...http://rubydoc.info/gems/watir/Watir/Element#attribute_value-instance... > > Željko > -- > watir.com/book - author
The problem is, if there is javascript that is running 'onload' then it's going to be a race between watir trying to examine the object, and javascript that might be modifying it. potentially to automate somethign like this, you might have to request the HTML directly with something like HTTP-Party, parse it with something like nokogiri, and pull out the stated attributes that would be there as the page loads, and before any CSS rules or Javascript have done their thing. if you just want to observe and verify and not automate a test for this, something like fiddler2 (if you are on windows) would let you look at every raw file that went into composing the page, as they were transferred from the server, so you could find the thing in the HTML files, and compare the attributes there with what is seen in the dom using developer tools. Developer tools can also show you things like applied styles etc. What is the purpose of a test like this? seems like a fair bit of effort, and if the item is being altered on the fly, does the original state really matter that much, or just that it ends up in the correct state after all CSS rules and Javascript have done their thing? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
