Module: Howitzer::Meta::Actions
Overview
Module with utility actions for elements
Instance Method Summary collapse
-
#highlight(*args, **options) ⇒ Object
Highlights element with red border on the page.
-
#xpath(*args, **options) ⇒ String?
Returns xpath for the element.
Instance Method Details
#highlight(*args, **options) ⇒ Object
Highlights element with red border on the page
8 9 10 11 12 13 14 15 16 17 18 |
# 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 element = escape(xpath(*args, **)) context.execute_script( "document.evaluate('#{element}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)." \ 'singleNodeValue.style.border = "thick solid red"' ) end |
#xpath(*args, **options) ⇒ String?
Returns xpath for the element
24 25 26 |
# File 'lib/howitzer/meta/actions.rb', line 24 def xpath(*args, **) (*args, **).try(:path) end |