mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
#within_frame method
This commit is contained in:
parent
5c20277dfa
commit
8ad161b041
4 changed files with 14 additions and 2 deletions
|
|
@ -27,6 +27,10 @@ class Capybara::Driver::Base
|
|||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def within_frame frame_id
|
||||
raise Capybara::NotSupportedByDriverError
|
||||
end
|
||||
|
||||
def source
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
|
|
|||
|
|
@ -103,7 +103,12 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
|
|||
def browser
|
||||
self.class.driver
|
||||
end
|
||||
|
||||
def with_frame(frame_id)
|
||||
old_window = browser.window_handle
|
||||
browser.switch_to.frame(frame_id)
|
||||
yield
|
||||
browser.switch_to.window old_window
|
||||
end
|
||||
private
|
||||
|
||||
def url(path)
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ describe Capybara::Driver::Selenium do
|
|||
it_should_behave_like "driver"
|
||||
it_should_behave_like "driver with javascript support"
|
||||
it_should_behave_like "driver without node path support"
|
||||
|
||||
it_should_behave_like "driver with frame support"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
||||
|
||||
shared_examples_for 'driver with frame support' do
|
||||
it_should_behave_like 'within_frame'
|
||||
end
|
||||
shared_examples_for 'driver' do
|
||||
|
||||
describe '#visit' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue