Permalink
Browse files

Navigate to about:blank to reset page instead of empty file

closes #1035
closes #1214
closes #1203
closes #1198
closes #1215

Since it does not work with remote drivers, and somehow screws up on Windows.
  • Loading branch information...
1 parent f18637b commit 03ec8486c6a70389c5f19815c85e1376e386935f @jnicklas jnicklas committed Jan 6, 2014
Showing with 3 additions and 20 deletions.
  1. +0 −2 lib/capybara.rb
  2. +0 −4 lib/capybara/empty.html
  3. +1 −3 lib/capybara/selenium/driver.rb
  4. +2 −11 lib/capybara/spec/session/reset_session_spec.rb
View
@@ -14,8 +14,6 @@ class UnselectNotAllowed < CapybaraError; end
class NotSupportedByDriverError < CapybaraError; end
class InfiniteRedirectError < CapybaraError; end
- EMPTY_HTML_FILE_PATH = File.expand_path('./capybara/empty.html', File.dirname(__FILE__))
-
class << self
attr_accessor :asset_host, :app_host, :run_server, :default_host, :always_include_port
attr_accessor :server_port, :exact, :match, :exact_options, :visible_text_only
View
@@ -1,4 +0,0 @@
-<!doctype>
-<html>
- <!-- an empty HTML document, used for resetting the page content -->
-</html>
@@ -97,9 +97,7 @@ def reset!
# to about:blank, so we rescue this error and do nothing
# instead.
end
- uri = URI(Capybara::EMPTY_HTML_FILE_PATH)
- uri.scheme = "file"
- @browser.navigate.to(uri.to_s)
+ @browser.navigate.to("about:blank")
@JimiJonJimbo

JimiJonJimbo Feb 7, 2014

With ChromeDriver 2.9 on OS X 10.9.1, elements on pages are unable to receive focus after the browser navigates to about:blank.

@jnicklas

jnicklas Feb 7, 2014

Collaborator

As in, it never fixes itself, even when going to a normal page afterwards? That sounds like a bug in chromedriver in that case, IMO.

end
end
@@ -16,17 +16,8 @@
@session.current_path.should == '/foo'
@session.reset_session!
- [
- ->(v) { v == nil },
- ->(v) { v == '' },
- ->(v) { v == 'about:blank' },
- ->(v) { v.end_with? Capybara::EMPTY_HTML_FILE_PATH } # allow file:// protocol
- ].any? { |p| p.(@session.current_url) }.should be_true
- [
- ->(v) { v == '' },
- ->(v) { v == nil },
- ->(v) { v == Capybara::EMPTY_HTML_FILE_PATH }
- ].any? { |p| p.(@session.current_path) }.should be_true
+ [nil, '', 'about:blank'].should include(@session.current_url)
+ ['', nil].should include(@session.current_path)
@session.current_host.should be_nil
end

0 comments on commit 03ec848

Please sign in to comment.