lib/howitzer/web/capybara_methods_proxy.rb in howitzer-2.1.1 vs lib/howitzer/web/capybara_methods_proxy.rb in howitzer-2.2.0
- old
+ new
@@ -7,17 +7,19 @@
class Capybara::Selenium::Driver # rubocop:disable Style/ClassAndModuleChildren
#
# https://github.com/teamcapybara/capybara/issues/1845
def title
return browser.title unless within_frame?
+
find_xpath('/html/head/title').map { |n| n[:text] }.first.to_s
end
# Known issue, works differently for phantomjs and real browsers
# https://github.com/seleniumhq/selenium/issues/1727
def current_url
return browser.current_url unless within_frame?
+
execute_script('return document.location.href')
end
private
@@ -55,10 +57,11 @@
end
private
def capybara_scopes
- @_scopes ||= [Capybara.current_session]
+ @capybara_scopes ||= Hash.new { |hash, key| hash[key] = [Capybara.current_session] }
+ @capybara_scopes[Howitzer.session_name]
end
end
end
end