Class: Celerity::Frame
- Includes:
- Container, XpathSupport
- Defined in:
- lib/celerity/elements/frame.rb
Constant Summary collapse
- TAGS =
[Identifier.new('frame'), Identifier.new('iframe')]
- ATTRIBUTES =
BASE_ATTRIBUTES | [:longdesc, :name, :src, :frameborder, :marginwidth, :marginheight, :noresize, :scrolling]
- DEFAULT_HOW =
:name
Constants inherited from Element
Element::BASE_ATTRIBUTES, Element::CELLHALIGN_ATTRIBUTES, Element::CELLVALIGN_ATTRIBUTES, Element::HTML_401_TRANSITIONAL, Element::TO_S_SIZE
Instance Attribute Summary collapse
-
#page ⇒ Object
Returns the value of attribute page.
Attributes included from Container
Attributes inherited from Element
Instance Method Summary collapse
-
#assert_exists ⇒ Object
private
Override assert_exists to raise UnknownFrameException (for Watir compatibility).
-
#execute_script(source) ⇒ Object
Executes the given JavaScript string in this frame.
-
#locate ⇒ Object
private
Override the default locate to handle frame and inline frames.
- #method_missing(meth, *args, &blk) ⇒ Object
- #to_s ⇒ Object
-
#update_page(value) ⇒ Object
private
Updates the brwoser page with the page from this frame’s top window.
Methods included from XpathSupport
#element_by_xpath, #element_from_dom_node, #elements_by_xpath
Methods included from Container
#area, #areas, #button, #buttons, #cell, #cells, #check_box, #checkboxes, #container=, #contains_text, #dd, #dds, #div, #divs, #dl, #dls, #dt, #dts, #em, #ems, #file_field, #file_fields, #form, #forms, #frame, #frames, #h1, #h1s, #h2, #h2s, #h3, #h3s, #h4, #h4s, #h5, #h5s, #h6, #h6s, #hidden, #hiddens, #image, #images, #inspect, #label, #labels, #li, #link, #links, #lis, #map, #maps, #meta, #metas, #ol, #ols, #option, #p, #pre, #pres, #ps, #radio, #radios, #row, #rows, #select_list, #select_lists, #span, #spans, #strong, #strongs, #table, #tables, #tbodies, #tbody, #text_field, #text_fields, #tfoot, #tfoots, #th, #thead, #theads, #ths, #ul, #uls
Methods included from ShortInspect
Methods inherited from Element
#attribute_string, #attribute_value, #exists?, #fire_event, #focus, #initialize, #javascript_object, #methods, #object, #parent, #respond_to?, #text, #to_xml, #visible?, #xpath
Constructor Details
This class inherits a constructor from Celerity::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/celerity/elements/frame.rb', line 65 def method_missing(meth, *args, &blk) meth = selector_to_attribute(meth) if self.class::ATTRIBUTES.include?(meth) assert_exists @inline_frame_object.getAttribute(meth.to_s) else Log.warn "Element\#method_missing calling super with #{meth.inspect}" super end end |
Instance Attribute Details
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/celerity/elements/frame.rb', line 6 def page @page end |
Instance Method Details
#assert_exists ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override assert_exists to raise UnknownFrameException (for Watir compatibility)
33 34 35 36 37 38 |
# File 'lib/celerity/elements/frame.rb', line 33 def assert_exists locate unless @object raise UnknownFrameException, "unable to locate frame, using #{identifier_string}" end end |
#execute_script(source) ⇒ Object
Executes the given JavaScript string in this frame. (Celerity only)
44 45 46 47 |
# File 'lib/celerity/elements/frame.rb', line 44 def execute_script(source) assert_exists @page.executeJavaScript(source.to_s).getJavaScriptResult end |
#locate ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override the default locate to handle frame and inline frames.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/celerity/elements/frame.rb', line 17 def locate super if @object @inline_frame_object = @object.getEnclosedWindow.getFrameElement self.page = @object.getEnclosedPage if (frame = self.page.getDocumentElement) @object = frame end end end |
#to_s ⇒ Object
60 61 62 63 |
# File 'lib/celerity/elements/frame.rb', line 60 def to_s assert_exists create_string(@inline_frame_object) end |
#update_page(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Updates the brwoser page with the page from this frame’s top window. Used internally.
56 57 58 |
# File 'lib/celerity/elements/frame.rb', line 56 def update_page(value) @browser.page = value.getEnclosingWindow.getTopWindow.getEnclosedPage end |