Class: Celerity::Frame
- Inherits:
-
Celerity::Element
- Object
- Celerity::Element
- Celerity::Frame
- Includes:
- Celerity::Container, Celerity::XpathSupport
- Defined in:
- lib/celerity/elements/frame.rb
Overview
Frame
Constant Summary
- TAGS =
[Identifier.new('frame'), Identifier.new('iframe')]
- ATTRIBUTES =
BASE_ATTRIBUTES | [ :frameborder, :longdesc, :marginheight, :marginwidth, :name, :noresize, :scrolling, :src, ]
- DEFAULT_HOW =
:name
Constants inherited from Celerity::Element
ATTRIBUTES, BASE_ATTRIBUTES, CELLHALIGN_ATTRIBUTES, CELLVALIGN_ATTRIBUTES, DEFAULT_HOW, HTML_401_TRANSITIONAL, TAGS
Attribute Summary
- - (Object) page Returns the value of attribute page.
Method Summary
- - (Object) assert_exists Override assert_exists to raise UnknownFrameException (for Watir compatibility).
- - (Object) execute_script(source) Executes the given JavaScript string in this frame.
- - (Object) locate Override the default locate to handle frame and inline frames.
- - (Object) method_missing(meth, *args, &blk)
- - (Object) to_s
- - (Object) update_page(value) Updates the brwoser page with the page from this frame’s top window.
Methods included from Celerity::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, #rescue_status_code_exception, #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 Celerity::ShortInspect
Methods included from Celerity::XpathSupport
#element_by_xpath, #element_from_dom_node, #elements_by_xpath
Methods inherited from Celerity::Element
#==, #attribute_string, #attribute_value, #exists?, #fire_event, #focus, #identifier_string, #initialize, #javascript_object, #methods, #object, #parent, #respond_to?, #selector_to_attribute, #text, #to_xml, #visible?, #xpath
Methods included from Celerity::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, #rescue_status_code_exception, #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 Celerity::ShortInspect
Constructor Details
This class inherits a constructor from Celerity::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(meth, *args, &blk)
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/celerity/elements/frame.rb', line 74 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 |
Attribute Details
- (Object) page
Returns the value of attribute page
6 7 8 |
# File 'lib/celerity/elements/frame.rb', line 6 def page @page end |
Method Details
- (Object) assert_exists
Override assert_exists to raise UnknownFrameException (for Watir compatibility)
42 43 44 45 46 47 |
# File 'lib/celerity/elements/frame.rb', line 42 def assert_exists locate unless @object raise UnknownFrameException, "unable to locate frame, using #{identifier_string}" end end |
- (Object) execute_script(source)
Executes the given JavaScript string in this frame. (Celerity only)
53 54 55 56 |
# File 'lib/celerity/elements/frame.rb', line 53 def execute_script(source) assert_exists @page.executeJavaScript(source.to_s).getJavaScriptResult end |
- (Object) locate
Override the default locate to handle frame and inline frames.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/celerity/elements/frame.rb', line 26 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 |
- (Object) to_s
69 70 71 72 |
# File 'lib/celerity/elements/frame.rb', line 69 def to_s assert_exists Celerity::Util.create_string @inline_frame_object end |
- (Object) update_page(value)
Updates the brwoser page with the page from this frame’s top window. Used internally.
65 66 67 |
# File 'lib/celerity/elements/frame.rb', line 65 def update_page(value) @browser.page = value.getEnclosingWindow.getTopWindow.getEnclosedPage end |