Class: Watir::Frame

Inherits:
Element show all
Includes:
PageContainer
Defined in:
lib/watir-classic/frame.rb

Constant Summary

Constants included from Win32

Win32::FindWindowEx, Win32::GW_CHILD, Win32::GW_ENABLEDPOPUP, Win32::GW_HWNDFIRST, Win32::GW_HWNDLAST, Win32::GW_HWNDNEXT, Win32::GW_HWNDPREV, Win32::GW_MAX, Win32::GW_OWNER, Win32::GetUnknown, Win32::GetWindow, Win32::IsWindow, Win32::User32

Constants inherited from Element

Element::TO_S_SIZE

Instance Attribute Summary collapse

Attributes inherited from Element

#container

Attributes included from Container

#activeObjectHighLightColor, #page_container, #type_keys, #typingspeed

Instance Method Summary collapse

Methods included from PageContainer

#check_for_http_error, #contains_text, #enabled_popup, #execute_script, #html, #set_container, #text, #url

Methods included from Win32

window_exists?

Methods included from Exception

message_for_unable_to_locate

Methods inherited from Element

#<=>, #activeObjectHighLightColor, #assert_enabled, #assert_exists, #attribute_value, #click, #click!, #create_event, #disabled?, #dispatch_event, #double_click, #enabled?, #exists?, #fire_event, #flash, #focus, #focused?, #inspect, #method_missing, #ole_object, #ole_object=, #parent, #right_click, #send_keys, #style, #tag_name, #text, #to_s, #to_subtype, #type_keys, #typingspeed, #visible?

Methods included from DragAndDropHelper

#drag_and_drop_by, #drag_and_drop_on

Methods included from Container

#alert, #locator_for, #modal_dialog, #set_container, support_element, #wait

Methods included from ElementExtensions

#present?, #wait_until_present, #wait_while_present, #when_present

Constructor Details

#initialize(container, specifiers) ⇒ Frame

Returns a new instance of Frame.



9
10
11
12
# File 'lib/watir-classic/frame.rb', line 9

def initialize(container, specifiers)
  super
  copy_test_config container
end

Dynamic Method Handling

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

Instance Attribute Details

#documentObject

Returns the value of attribute document.



4
5
6
# File 'lib/watir-classic/frame.rb', line 4

def document
  @document
end

Instance Method Details

#__ole_inner_elementsObject



29
30
31
# File 'lib/watir-classic/frame.rb', line 29

def __ole_inner_elements
  document.body.all
end

#attach_commandObject



42
43
44
# File 'lib/watir-classic/frame.rb', line 42

def attach_command
  @container.page_container.attach_command + ".frame(#{@specifiers.inspect})".gsub('"','\'')
end

#locateObject

Find the frame denoted by specifiers in the container and return its ole_object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/watir-classic/frame.rb', line 15

def locate
  frame, document = @container.locator_for(FrameLocator, @specifiers, self.class).locate
  if frame && document
    @o = frame
    begin
      @document = document.document
    rescue WIN32OLERuntimeError => e
      # This frame's content is not directly accessible but let the
      # user continue so they can access the frame properties            
      raise e unless e.message =~ /Access is denied/
    end        
  end
end