Skip to content

Commit

Permalink
Selenium resets session more thoroughly between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jnicklas committed Apr 7, 2011
1 parent 7a9b784 commit 0062f7f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/capybara/driver/selenium_driver.rb
Expand Up @@ -163,7 +163,10 @@ def evaluate_script(script)

def reset!
# Use instance variable directly so we avoid starting the browser just to reset the session
@browser.manage.delete_all_cookies if @browser
if @browser
@browser.manage.delete_all_cookies
@browser.navigate.to('about:blank')
end
end

def within_frame(frame_id)
Expand Down
3 changes: 2 additions & 1 deletion lib/capybara/session.rb
Expand Up @@ -113,7 +113,8 @@ def source
# @return [String] Path of the current page, without any domain information
#
def current_path
URI.parse(current_url).path
path = URI.parse(current_url).path
path if path and not path.empty?
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/spec/session.rb
Expand Up @@ -75,7 +75,7 @@ def extract_results(session)
@session.current_path.should == '/with_html'

@session.reset!
@session.current_path.should == ""
@session.current_path.should be_nil
end

it "resets page body" do
Expand Down

0 comments on commit 0062f7f

Please sign in to comment.