Class: WebDriverScriptAdapter::FrameAdapter::ParentlessFrameAdapter

Inherits:
DumbDelegator
  • Object
show all
Defined in:
lib/webdriver_script_adapter/frame_adapter.rb

Overview

Selenium Webdriver < 2.43 doesnt support moving back to the parent

Instance Method Summary collapse

Instance Method Details

#within_frame(frame) ⇒ Object

storage of frame stack (for reverting to parent) taken from Capybara : github.com/jnicklas/capybara/blob/2.6.2/lib/capybara/selenium/driver.rb#L117-L147

There doesnt appear to be any way in Selenium Webdriver < 2.43 to move back to a parent frame other than going back to the root and then reiterating down



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/webdriver_script_adapter/frame_adapter.rb', line 101

def within_frame(frame)
  @frame_stack[window_handle] ||= []
  @frame_stack[window_handle] << frame

  switch_to.frame(frame)
  yield
ensure
  @frame_stack[window_handle].pop
  switch_to.default_content
  @frame_stack[window_handle].each { |f| switch_to.frame(f) }
end