Class: Howitzer::Meta::Iframe
- Inherits:
-
Object
- Object
- Howitzer::Meta::Iframe
- Includes:
- Actions
- Defined in:
- lib/howitzer/meta/iframe.rb
Overview
This class represents iframe entity within howitzer meta information interface
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#capybara_element(wait: 0) ⇒ Capybara::Node::Element?
Finds iframe on the page and returns as a capybara element.
-
#capybara_elements ⇒ Array
Finds all instances of iframe on the page and returns them as array of capybara elements.
-
#initialize(name, context) ⇒ Iframe
constructor
Creates new meta iframe element with meta information and utility actions.
-
#site_value ⇒ String
Returns url value for iframe.
Methods included from Actions
Constructor Details
#initialize(name, context) ⇒ Iframe
Creates new meta iframe element with meta information and utility actions
12 13 14 15 |
# File 'lib/howitzer/meta/iframe.rb', line 12 def initialize(name, context) @name = name @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/howitzer/meta/iframe.rb', line 5 def context @context end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/howitzer/meta/iframe.rb', line 5 def name @name end |
Instance Method Details
#capybara_element(wait: 0) ⇒ Capybara::Node::Element?
Finds iframe on the page and returns as a capybara element
26 27 28 29 30 |
# File 'lib/howitzer/meta/iframe.rb', line 26 def (wait: 0) context..find("iframe[src='#{site_value}']", match: :first, wait: wait) rescue Capybara::ElementNotFound nil end |
#capybara_elements ⇒ Array
Finds all instances of iframe on the page and returns them as array of capybara elements
19 20 21 |
# File 'lib/howitzer/meta/iframe.rb', line 19 def context..all("iframe[src='#{site_value}']") end |
#site_value ⇒ String
Returns url value for iframe
34 35 36 37 38 |
# 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 |