diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c07250..636b384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ### Added ### Changed +- `Driver#current_url` and `Driver#title` read Ferrum's `url` and `title` of the window, not `current_url` and + `current_title` deprecated in Ferrum 0.21 [rubycdp/ferrum#687] ### Fixed diff --git a/docs/1-introduction.md b/docs/1-introduction.md index ad2d639..57e74a8 100644 --- a/docs/1-introduction.md +++ b/docs/1-introduction.md @@ -91,9 +91,9 @@ browser.downloads.files A few things to keep in mind: -- It follows Capybara. Page methods such as `browser.evaluate`, `browser.css` - or `browser.current_url` run in the window and frame Capybara is switched to, - for example inside `within_window` or `within_frame`. +- It follows Capybara. Page methods such as `browser.evaluate` or `browser.css` + run in the window and frame Capybara is switched to, for example inside + `within_window` or `within_frame`. - It's reset between tests. Capybara's reset disposes the browser context, so headers, cookies, request interception, recorded traffic, console messages and downloads are gone in the next test. Browser-wide settings such as diff --git a/lib/capybara/cuprite/driver.rb b/lib/capybara/cuprite/driver.rb index 478fc33..4804a1f 100644 --- a/lib/capybara/cuprite/driver.rb +++ b/lib/capybara/cuprite/driver.rb @@ -26,10 +26,9 @@ class Driver < Capybara::Driver::Base extend Forwardable include Extensions - delegate %i[quit current_url title - window_handles current_window_handle close_window switch_to_window - refresh] => :browser + delegate %i[quit title window_handles current_window_handle close_window switch_to_window refresh] => :browser delegate %i[send_keys] => :active_element + def_delegator :browser, :url, :current_url def_delegator :browser, :body, :html def_delegator :browser, :back, :go_back def_delegator :browser, :forward, :go_forward diff --git a/lib/capybara/cuprite/page/frames.rb b/lib/capybara/cuprite/page/frames.rb index b1b7ee9..608dd90 100644 --- a/lib/capybara/cuprite/page/frames.rb +++ b/lib/capybara/cuprite/page/frames.rb @@ -8,9 +8,7 @@ class Page < Ferrum::Page module Frames extend Forwardable - delegate %i[at_css at_xpath css xpath - current_url current_title body execution_id execution_id! - evaluate execute] => :active_frame + delegate %i[at_css at_xpath css xpath body execution_id execution_id! evaluate execute] => :active_frame def initialize(...) @frame_stack = [] @@ -28,10 +26,6 @@ def switch_to_frame(handle) end end - def title - active_frame.current_title - end - private def active_frame diff --git a/spec/features/session_spec.rb b/spec/features/session_spec.rb index 99cb15e..f09be4d 100644 --- a/spec/features/session_spec.rb +++ b/spec/features/session_spec.rb @@ -1443,7 +1443,7 @@ browser.goto("http://example.com") puts "Please type enter" sleep 1 - browser.current_url + browser.url RUBY end