class Howitzer::Meta::Iframe

This class represents iframe entity within howitzer meta information interface

Attributes

context[R]
name[R]

Public Class Methods

new(name, context) click to toggle source

Creates new meta iframe element with meta information and utility actions @param name [String] name of the iframe @param context [Howitzer::Web::Page] page which has this iframe

# File lib/howitzer/meta/iframe.rb, line 12
def initialize(name, context)
  @name = name
  @context = context
end

Public Instance Methods

capybara_element(wait: 0) click to toggle source

Finds iframe on the page and returns as a capybara element @param wait [Integer] wait time for element search @return [Capybara::Node::Element, nil]

# File lib/howitzer/meta/iframe.rb, line 26
def capybara_element(wait: 0)
  context.capybara_context.find("iframe[src='#{site_value}']", match: :first, wait: wait)
rescue Capybara::ElementNotFound
  nil
end
capybara_elements() click to toggle source

Finds all instances of iframe on the page and returns them as array of capybara elements @return [Array]

# File lib/howitzer/meta/iframe.rb, line 19
def capybara_elements
  context.capybara_context.all("iframe[src='#{site_value}']")
end
site_value() click to toggle source

Returns url value for iframe @return [String]

# File lib/howitzer/meta/iframe.rb, line 34
def site_value
  return @site_value if @site_value.present?

  context.send("#{name}_iframe") { |frame| @site_value = frame.class.send(:site_value) }
end