lib/watir-classic/element.rb in watir-classic-3.2.0 vs lib/watir-classic/element.rb in watir-classic-3.3.0
- old
+ new
@@ -111,13 +111,20 @@
focus
page_container.send_keys *keys
end
# return the css style as a string
- def style
+ def style(property=nil)
assert_exists
- ole_object.style.cssText
+ css = ole_object.style.cssText
+
+ if property
+ properties = Hash[css.downcase.split(";").map { |p| p.split(":").map(&:strip) }]
+ properties[property]
+ else
+ css
+ end
end
# Return the innerText of the object or an empty string if the object is
# not visible
# Raise an ObjectNotFound exception if the object cannot be found
@@ -341,10 +348,10 @@
# raises: UnknownObjectException if the object is not found
# ObjectDisabledException if the object is currently disabled
def focus
assert_exists
assert_enabled
- @page_container.focus
+ @container.focus
ole_object.focus(0)
end
def focused?
assert_exists