Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- Ferrum is bumped to `~> 0.19.0`

### Fixed
- `Driver#send_keys` clicked the focused element before typing, so `send_keys(:tab)` from `<body>` clicked the middle of
the page and Tab moved focus from there instead of to the first element. It types into the focused element now, and
Capybara's `#active_element` and `focused:` specs run in the suite
- `window_size: nil` raised `Ferrum::BrowserError: Invalid parameters` on every page instead of leaving the window
size to Chrome, so `start-maximized` couldn't be used [#278]
- `Driver#reset!` kept the page it had cached when the browser failed to reset, so every later example raised
Expand Down
6 changes: 5 additions & 1 deletion lib/capybara/cuprite/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Driver < Capybara::Driver::Base
delegate %i[restart quit status_code timeout timeout= current_url title body
window_handles close_window switch_to_window within_window window_handle
back forward refresh wait_for_reload viewport_size device_pixel_ratio] => :browser
delegate %i[send_keys] => :active_element
alias html body
alias current_window_handle window_handle
alias go_back back
Expand Down Expand Up @@ -75,6 +74,11 @@ def active_element
Node.new(self, browser.active_element)
end

def send_keys(*keys)
keys = keys.reject { |key| key.nil? || key == "" }
browser.page.keyboard.type(keys) unless keys.empty?
end

def find_xpath(selector)
find(:xpath, selector)
end
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ module TestSessions

metadata[:skip] = true if metadata[:full_description].match(/#{regexes}/)
metadata[:skip] = "Intentionally skipped" if metadata[:full_description].match(/#{intentional_skip}/)
metadata[:skip] = true if metadata[:requires]&.include?(:active_element)
end

config.around do |example|
Expand Down
Loading