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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Correctly set mouse events buttons property [#509]
- Prevent 'Hash#[]=': can't add a new key into hash during iteration [#513]
- `Ferrum::Network::Exchange#finished?` and `Ferrum::Network#wait_for_idle` take into account that request can be a blob [#496]
- Safe call _body_ method (DOM) when page is empty and no html [#522]

### Removed

Expand Down
2 changes: 1 addition & 1 deletion lib/ferrum/frame/dom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def doctype
# browser.body # => '<html itemscope="" itemtype="http://schema.org/WebPage" lang="ru"><head>...
#
def body
evaluate("document.documentElement.outerHTML")
evaluate("document.documentElement?.outerHTML") || ""
end

#
Expand Down
2 changes: 1 addition & 1 deletion spec/network_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,6 @@
%r{Request to http://.*/with_js failed \(net::ERR_INTERNET_DISCONNECTED\)}
)

expect(page.at_css("body").text).to match("No internet")
Copy link
Contributor Author

@Mihoid Mihoid Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes are a little bit confusing me 🤔

expect(page.at_css("body").text).to match("")
end
end
4 changes: 2 additions & 2 deletions spec/unit/browser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def puts(*args)
browser = Ferrum::Browser.new(logger: logger)
browser.body
file_log = File.read(file_path)
expect(file_log).to include("return document.documentElement.outerHTML")
expect(file_log).to include("return document.documentElement?.outerHTML")
expect(file_log).to include("<html><head></head><body></body></html>")
ensure
FileUtils.rm_f(file_path)
Expand All @@ -32,7 +32,7 @@ def puts(*args)

browser.body

expect(logger.string).to include("return document.documentElement.outerHTML")
expect(logger.string).to include("return document.documentElement?.outerHTML")
expect(logger.string).to include("<html><head></head><body></body></html>")
ensure
browser.quit
Expand Down
Loading