Class: Watir::Frame

Inherits:
HTMLElement show all
Defined in:
lib/watir-webdriver/elements/frame.rb,
lib/watir-webdriver/elements/generated.rb

Constant Summary collapse

VALID_LOCATORS =
[:id, :name, :index]

Constants inherited from BaseElement

BaseElement::IGNORED_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from BaseElement

attribute_list, #attribute_value, attributes, #click, #double_click, #driver, #element, #exists?, #fire_event, #flash, #focus, #html, #inspect, #parent, #right_click, #run_checkers, #send_keys, #style, #tag_name, #text, typed_attributes, #value, #visible?

Methods included from Container

add

Constructor Details

#initialize(*args) ⇒ Frame

Returns a new instance of Frame.



7
8
9
10
# File 'lib/watir-webdriver/elements/frame.rb', line 7

def initialize(*args)
  super
  @frame_id = nil
end

Instance Method Details

#assert_existsObject



25
26
27
28
29
# File 'lib/watir-webdriver/elements/frame.rb', line 25

def assert_exists
  @parent.assert_exists
  # we always run locate(), to make sure the frame is switched
  @element = locate
end

#element_by_xpath(*args) ⇒ Object



35
36
37
38
# File 'lib/watir-webdriver/elements/frame.rb', line 35

def element_by_xpath(*args)
  assert_exists
  super
end

#elements_by_xpath(*args) ⇒ Object



40
41
42
43
# File 'lib/watir-webdriver/elements/frame.rb', line 40

def elements_by_xpath(*args)
  assert_exists
  super
end

#execute_script(*args) ⇒ Object



31
32
33
# File 'lib/watir-webdriver/elements/frame.rb', line 31

def execute_script(*args)
  browser.execute_script(*args)
end

#locateObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/watir-webdriver/elements/frame.rb', line 12

def locate
  @parent.assert_exists

  if @iframe
    return @iframe
  elsif @frame_id.nil?
    locate_iframe || locate_frame
  else
    switch!
    driver
  end
end