File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 11name : Linter
2- on : [push]
2+ on :
3+ push :
4+ branches :
5+ - main
6+ pull_request :
37
48jobs :
59 linters :
Original file line number Diff line number Diff line change 33### Added
44
55- ` Ferrum::Network#wait_for_idle! ` raises an error if timeout reached.
6+ - ` Ferrum::Browser#close ` closes browser gracefully issuing a CDP command, doesn't clean up ruby resources.
67
78### Changed
89
Original file line number Diff line number Diff line change @@ -218,10 +218,22 @@ def quit
218218 @client = @process = @contexts = nil
219219 end
220220
221+ #
222+ # Crashes browser.
223+ #
221224 def crash
222225 command ( "Browser.crash" )
223226 end
224227
228+ #
229+ # Close browser gracefully.
230+ #
231+ # You should clean up resources/connections in ruby world manually, it's only a CDP command.
232+ #
233+ def close
234+ command ( "Browser.close" )
235+ end
236+
225237 #
226238 # Gets the version information from the browser.
227239 #
Original file line number Diff line number Diff line change 329329 end
330330 end
331331
332+ describe "#close" do
333+ it "works after crash with explicit restart" do
334+ browser . go_to
335+
336+ expect { browser . close } . not_to raise_error
337+ sleep 2
338+ expect { browser . go_to } . to raise_error ( Ferrum ::DeadBrowserError )
339+
340+ browser . restart
341+ browser . go_to
342+
343+ expect ( browser . body ) . to include ( "Hello world" )
344+ end
345+ end
346+
332347 describe "#version" do
333348 it "returns browser version information" do
334349 version_info = browser . version
You can’t perform that action at this time.
0 commit comments