Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
[rubycdp/ferrum#716]

### Fixed
- Setting a text field to a value ending in `\n` no longer fails now and then with `Ferrum::NoExecutionContextError`
when the form submits and the page navigates away before the field refocuses
- `response_headers` are looked up case-insensitively as with rack_test, `["Content-Type"]` returned `nil`
- A click on a node the page removes before the hit test raises `ObsoleteNode`, which Capybara retries, instead of
`Ferrum::JavaScriptError: node.getRootNode(...).elementFromPoint is not a function` [#359]
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/cuprite/node/typing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def move_caret_to_end

def refocus
node.evaluate("this.blur(); this.focus()")
rescue Ferrum::NodeNotFoundError
rescue Ferrum::NodeNotFoundError, Ferrum::NoExecutionContextError
nil
end
end
Expand Down
11 changes: 11 additions & 0 deletions spec/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,17 @@
expect(element.value).to eq("Hello there!")
end

it "sets the value when the page navigates away before the field refocuses" do
element = @session.find(:css, "#change_me")
node = element.native.node
allow(node).to receive(:evaluate).and_call_original
allow(node).to receive(:evaluate).with("this.blur(); this.focus()").and_raise(Ferrum::NoExecutionContextError)

element.native.set("Hello")

expect(element.value).to eq("Hello")
end

it "raises for an unknown clear: value" do
element = @session.find(:css, "#change_me")
expect { element.set("a", clear: :foo) }
Expand Down
Loading