Class: Watir::IFrame

Inherits:
HTMLElement show all
Defined in:
lib/watir/elements/iframe.rb,
lib/watir/elements/html_elements.rb

Direct Known Subclasses

Frame

Constant Summary

Constants inherited from Element

Element::CASE_INSENSITIVE_ATTRIBUTES

Instance Attribute Summary

Attributes inherited from Element

#keyword, #selector

Instance Method Summary collapse

Methods inherited from HTMLElement

#accesskey, #content_editable, #content_editable?, #dataset, #dir, #draggable?, #hidden?, #innertext, #lang, #onabort, #onblur, #oncancel, #oncanplay, #oncanplaythrough, #onchange, #onclick, #onclose, #oncopy, #oncuechange, #oncut, #ondblclick, #ondrag, #ondragend, #ondragenter, #ondragexit, #ondragleave, #ondragover, #ondragstart, #ondrop, #ondurationchange, #onemptied, #onended, #onerror, #onfocus, #oninput, #oninvalid, #onkeydown, #onkeypress, #onkeyup, #onload, #onloadeddata, #onloadedmetadata, #onloadstart, #onmousedown, #onmouseenter, #onmouseleave, #onmousemove, #onmouseout, #onmouseover, #onmouseup, #onpaste, #onpause, #onplay, #onplaying, #onprogress, #onratechange, #onreset, #onresize, #onscroll, #onseeked, #onseeking, #onselect, #onshow, #onstalled, #onsubmit, #onsuspend, #ontimeupdate, #ontoggle, #onvolumechange, #onwaiting, #onwheel, #spellcheck?, #tabindex, #title, #translate?

Methods inherited from Element

#==, #attribute_list, #attribute_value, #attribute_values, #browser, #build, #cache=, #center, #class_name, #classes, #click, #click!, #double_click, #double_click!, #drag_and_drop_by, #drag_and_drop_on, #driver, #enabled?, #focused?, #hash, #height, #hover, #id, #in_viewport?, #initialize, #inspect, #locate, #located?, #location, #obscured?, #present?, #reset!, #right_click, #selector_string, #set, #shadow_root, #size, #stale?, #stale_in_context?, #style, #tag_name, #width

Methods included from AttributeHelper

#attribute, #attribute_list, #define_attribute, #define_boolean_attribute, #define_float_attribute, #define_int_attribute, #define_string_attribute, #inherit_attributes_from, #method, #typed_attributes

Methods included from SearchContext

#assert_exists, #check_condition, #element_call, #exists?, #wait_for_exists

Methods included from Scrolling

#scroll

Methods included from Locators::ClassHelpers

#class_from_string, #element_class_name, #element_matcher_class, #locator, #locator_class, #selector_builder, #selector_builder_class

Methods included from JSExecution

#fire_event, #flash, #focus, #inner_html, #inner_text, #outer_html, #select_text, #selected_text, #text_content

Methods included from Adjacent

#child, #children, #following_sibling, #following_siblings, #parent, #preceding_sibling, #preceding_siblings, #siblings

Methods included from Waitable

#wait_until, #wait_while

Methods included from Container

#a, #abbr, #abbrs, #address, #addresses, #area, #areas, #article, #articles, #as, #aside, #asides, #audio, #audios, #b, #base, #bases, #bdi, #bdis, #bdo, #bdos, #blockquote, #blockquotes, #body, #bodys, #br, #brs, #bs, #button, #buttons, #canvas, #canvases, #caption, #captions, #checkbox, #checkboxes, #circle, #circles, #cite, #cites, #code, #codes, #col, #colgroup, #colgroups, #cols, #data, #datalist, #datalists, #datas, #date_field, #date_fields, #date_time_field, #date_time_fields, #dd, #dds, #defs, #defss, #del, #dels, #desc, #descs, #details, #detailses, #dfn, #dfns, #dialog, #dialogs, #div, #divs, #dl, #dls, #dt, #dts, #element, #elements, #ellipse, #ellipses, #em, #embed, #embeds, #ems, #field_set, #field_sets, #fieldset, #fieldsets, #figcaption, #figcaptions, #figure, #figures, #file_field, #file_fields, #font, #fonts, #footer, #footers, #foreign_object, #foreign_objects, #form, #forms, #frame, #frames, #frameset, #framesets, #g, #gs, #h1, #h1s, #h2, #h2s, #h3, #h3s, #h4, #h4s, #h5, #h5s, #h6, #h6s, #head, #header, #headers, #heads, #hidden, #hiddens, #hr, #hrs, #htmls, #i, #iframe, #iframes, #image, #images, #img, #imgs, #input, #inputs, #ins, #inses, #is, #kbd, #kbds, #label, #labels, #legend, #legends, #li, #line, #linear_gradient, #linear_gradients, #lines, #link, #links, #lis, #main, #mains, #map, #maps, #mark, #marker, #markers, #marks, #meta, #metadata, #metadatas, #metas, #meter, #meters, #nav, #navs, #noscript, #noscripts, #object, #objects, #ol, #ols, #optgroup, #optgroups, #option, #options, #output, #outputs, #p, #param, #params, #path, #paths, #pattern, #patterns, #picture, #pictures, #polygon, #polygons, #polyline, #polylines, #pre, #pres, #progress, #progresses, #ps, #q, #qs, #radial_gradient, #radial_gradients, #radio, #radio_set, #radios, #rb, #rbs, #rect, #rects, #rp, #rps, #rt, #rtc, #rtcs, #rts, #rubies, #ruby, #s, #samp, #samps, #script, #scripts, #section, #sections, #select, #select_list, #select_lists, #selects, #small, #smalls, #source, #sources, #span, #spans, #ss, #stop, #stops, #strong, #strongs, #style, #styles, #sub, #subs, #summaries, #summary, #sup, #sups, #svg, #svgs, #switch, #switches, #symbol, #symbols, #table, #tables, #tbody, #tbodys, #td, #tds, #template, #templates, #text_field, #text_fields, #text_path, #text_paths, #textarea, #textareas, #tfoot, #tfoots, #th, #thead, #theads, #ths, #time, #times, #title, #titles, #tr, #track, #tracks, #trs, #tspan, #tspans, #u, #ul, #uls, #us, #use, #uses, #var, #vars, #video, #videos, #view, #views, #wbr, #wbrs

Methods included from JSSnippets

#execute_js

Constructor Details

This class inherits a constructor from Watir::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Watir::Element

Instance Method Details

#alignString

Returns value of align property.

Returns:

  • (String)

    value of align property



627
# File 'lib/watir/elements/html_elements.rb', line 627

attribute(String, :align, :align)

#allowfullscreen?Boolean

Returns value of allowFullscreen property.

Returns:

  • (Boolean)

    value of allowFullscreen property



622
# File 'lib/watir/elements/html_elements.rb', line 622

attribute("Boolean", :allowfullscreen?, :allowFullscreen)

#allowpaymentrequest?Boolean

Returns value of allowPaymentRequest property.

Returns:

  • (Boolean)

    value of allowPaymentRequest property



623
# File 'lib/watir/elements/html_elements.rb', line 623

attribute("Boolean", :allowpaymentrequest?, :allowPaymentRequest)

#contentdocumentString

Returns value of contentDocument property.

Returns:

  • (String)

    value of contentDocument property



625
# File 'lib/watir/elements/html_elements.rb', line 625

attribute(String, :contentdocument, :contentDocument)

#contentwindowString

Returns value of contentWindow property.

Returns:

  • (String)

    value of contentWindow property



626
# File 'lib/watir/elements/html_elements.rb', line 626

attribute(String, :contentwindow, :contentWindow)

#execute_script(script, *args, function_name: nil) ⇒ Object

Executes JavaScript snippet in context of frame.



49
50
51
52
53
54
55
56
57
# File 'lib/watir/elements/iframe.rb', line 49

def execute_script(script, *args, function_name: nil)
  args.map! do |e|
    Watir.logger.info "Executing Script on Frame: #{function_name}" if function_name
    e.is_a?(Element) ? e.wait_until(&:exists?).wd : e
  end
  returned = driver.execute_script(script, *args)

  browser.wrap_elements_in(self, returned)
end

#frameborderString

Returns value of frameBorder property.

Returns:

  • (String)

    value of frameBorder property



629
# File 'lib/watir/elements/html_elements.rb', line 629

attribute(String, :frameborder, :frameBorder)

#htmlString

Returns HTML code of iframe.

Returns:

  • (String)


31
32
33
# File 'lib/watir/elements/iframe.rb', line 31

def html
  wd.page_source
end

#longdescString

Returns value of longDesc property.

Returns:

  • (String)

    value of longDesc property



630
# File 'lib/watir/elements/html_elements.rb', line 630

attribute(String, :longdesc, :longDesc)

#marginheightString

Returns value of marginHeight property.

Returns:

  • (String)

    value of marginHeight property



631
# File 'lib/watir/elements/html_elements.rb', line 631

attribute(String, :marginheight, :marginHeight)

#marginwidthString

Returns value of marginWidth property.

Returns:

  • (String)

    value of marginWidth property



632
# File 'lib/watir/elements/html_elements.rb', line 632

attribute(String, :marginwidth, :marginWidth)

#nameString

Returns value of name property.

Returns:

  • (String)

    value of name property



620
# File 'lib/watir/elements/html_elements.rb', line 620

attribute(String, :name, :name)

#referrerpolicyString

Returns value of referrerPolicy property.

Returns:

  • (String)

    value of referrerPolicy property



624
# File 'lib/watir/elements/html_elements.rb', line 624

attribute(String, :referrerpolicy, :referrerPolicy)

#sandboxString

Returns value of sandbox property.

Returns:

  • (String)

    value of sandbox property



621
# File 'lib/watir/elements/html_elements.rb', line 621

attribute(String, :sandbox, :sandbox)

#scrollingString

Returns value of scrolling property.

Returns:

  • (String)

    value of scrolling property



628
# File 'lib/watir/elements/html_elements.rb', line 628

attribute(String, :scrolling, :scrolling)

#send_keys(*args) ⇒ Object

Delegate sending keystrokes to FramedDriver



39
40
41
# File 'lib/watir/elements/iframe.rb', line 39

def send_keys(*args)
  wd.send_keys(*args)
end

#srcString

Returns value of src property.

Returns:

  • (String)

    value of src property



618
# File 'lib/watir/elements/html_elements.rb', line 618

attribute(String, :src, :src)

#srcdocString

Returns value of srcdoc property.

Returns:

  • (String)

    value of srcdoc property



619
# File 'lib/watir/elements/html_elements.rb', line 619

attribute(String, :srcdoc, :srcdoc)

#switch_to!Object

Move Driver context into the iframe



9
10
11
12
# File 'lib/watir/elements/iframe.rb', line 9

def switch_to!
  locate unless located?
  wd.switch!
end

#textString

Returns text of iframe body. #body ensures context so this method does not have to

Returns:

  • (String)


21
22
23
# File 'lib/watir/elements/iframe.rb', line 21

def text
  body.text
end

#to_subtypeObject

Cast this Element instance to a more specific subtype. Cached element needs to be the IFrame element, not the FramedDriver



75
76
77
# File 'lib/watir/elements/iframe.rb', line 75

def to_subtype
  super.tap { |el| el.cache = @element }
end

#wdWatir::FramedDriver

Provides access to underlying Selenium Objects as delegated by FramedDriver

Returns:



65
66
67
68
# File 'lib/watir/elements/iframe.rb', line 65

def wd
  super
  FramedDriver.new(@element, browser)
end