Module: Howitzer::Meta::Actions
Overview
Module with utility actions for elements
Instance Method Summary collapse
-
#highlight(*args) ⇒ Object
Highlights element with red border on the page inline options for element/s as a hash.
-
#xpath(*args) ⇒ String?
Returns xpath for the element inline options for element/s as a hash.
Instance Method Details
#highlight(*args) ⇒ Object
Highlights element with red border on the page inline options for element/s as a hash
8 9 10 11 12 13 14 15 |
# File 'lib/howitzer/meta/actions.rb', line 8 def highlight(*args) if xpath(*args).blank? Howitzer::Log.debug("Element #{name} not found on the page") return end context.execute_script("document.evaluate('#{escape(xpath(*args))}', document, null, " \ 'XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.style.border = "thick solid red"') end |
#xpath(*args) ⇒ String?
Returns xpath for the element inline options for element/s as a hash
21 22 23 |
# File 'lib/howitzer/meta/actions.rb', line 21 def xpath(*args) (*args).try(:path) end |