Module: Howitzer::Meta::Actions

Included in:
Element, Iframe, Section
Defined in:
lib/howitzer/meta/actions.rb

Overview

Module with utility actions for elements

Instance Method Summary collapse

Instance Method Details

#highlight(*args) ⇒ Object

Highlights element with red border on the page inline options for element/s as a hash

Parameters:

  • args (Array)

    arguments for elements described with lambda locators and



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

Parameters:

  • args (Array)

    arguments for elements described with lambda locators and

Returns:

  • (String, nil)


21
22
23
# File 'lib/howitzer/meta/actions.rb', line 21

def xpath(*args)
  capybara_element(*args).try(:path)
end