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



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

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



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

def element_by_xpath(*args)
  assert_exists
  super
end

#elements_by_xpath(*args) ⇒ Object



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

def elements_by_xpath(*args)
  assert_exists
  super
end

#execute_script(*args) ⇒ Object



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

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

#locateObject



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

def locate
  @parent.assert_exists

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