Method: Capybara::Session#within

Defined in:
lib/capybara/session.rb

#within(kind, scope = nil) ⇒ Object



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

def within(kind, scope=nil)
  kind, scope = Capybara.default_selector, kind unless scope
  scope = XPath.from_css(scope) if kind == :css
  locate(:xpath, scope, "scope '#{scope}' not found on page")
  begin
    scopes.push(scope)
    yield
  ensure
    scopes.pop
  end
end