Repository navigation
Update dependency ferrum to '~> 0.22.0' - #282
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
'~> 0.20.1'→'~> 0.22.0'Release Notes
rubycdp/ferrum (ferrum)
v0.22.0Compare Source
Added
network.clear_cacheclears the browser's HTTP cache,network.clear_trafficthe collected traffic [#749]:ssl_contextfor connecting to the browser at anhttps:urlor awss:ws_urlwith your own TLS settings [#742]new_window:forcreate_targetandcreate_pageof a context and of the browser opens a window instead of a tabclose_targetof a context and of the browser closes a target and removes it from the context at once, sotargetsandpagesstop listing it right away instead of when Chrome reports it destroyed, as afterpage.closebrowser.on_page { |page| }calls the block with every new page, popups included, before Ferrum returns it, so thepage can be set up before anything runs on it
sig/, so type checkers pick them up without local stubs [#731]Network::Request#match?,#initial_priorityand#referrer_policy, andNetwork::AuthRequest#url_fragmentand#body, as all request classes now shareRequestParams[#743]mouse.wheel(delta_x:, delta_y:)turns the mouse wheel at the pointer, firing awheelevent and scrolling theelement under it, unlike
scroll_by[#744]RemoteObject#evaluate,#evaluate_handleand#executerun JavaScript withthisbound to the handle, as onNode[#746]Network::Response#from_disk_cache?and#from_service_worker?tell whether a response came from the disk cache ora service worker [#751]
browser.disconnectcloses the connection and leaves the browser running, soclose,disconnectandprocess.stopmake up a custom shutdown.quitstill stops a browser disconnected this way [#750]browser.shutdownasks the browser to exit, lets a launched one do so before killing it, and also shuts down aremote browser, unlike
quit.process.stop(grace:)waits that long before signaling [#750]context.downloadslists and awaits the downloads of every page in the context [#753]Changed
evaluateawaits a returned promise in the same CDP call, so an object result crosses the socket once instead oftwice, and an awaited script takes one call
Ferrum::ExecutionContextDestroyedErrorinstead ofFerrum::NodeNotFoundError, or a plainFerrum::BrowserErrorinan iframe, as no node is involved. It isn't retried
NodeorRemoteObjectargument from a previous page or another isolated world raisesFerrum::ForeignObjectErrorinstead ofFerrum::NodeNotFoundErrordownloads.filesandawait_downloadreturnFerrum::Downloadobjects instead of event hashes, withpathwhere Chrome saved the file,
state,completed?,suggested_filenameandto_hfor the raw params [#751]window_boundsreturns the shapewindow_bounds=takes, symbol keys andwindow_state:, instead of CDP's stringkeys and
"windowState"[#751]wss://connection to the browser verifies its certificate and host name and sends SNI, as thehttps/json/versionrequest already did. A self-signed browser needs:ssl_context, see the option [#742]User-AgentandAccept-Languageset throughheadersare only sent with requests, they no longer change whatnavigatorreports. Usenetwork.emulate(user_agent:, accept_language:)to override bothon(:request)oron(:auth)turns it on,network.interceptonlynarrows what's paused, and continues requests even before any callback is added.
authorizetakes an optionalblock [#745]
interceptnarrowsauthorize,blacklist=andwhitelist=too, they no longer reset it to*. Auth challenges and listed URLs outside the pattern aren't handled, widen it and filter withmatch?[#745]cookies.removewithout:domainor:url, a relativego_towithout:base_urland arelative
:save_pathraiseArgumentErrorinstead ofRuntimeErrororFerrum::Error. A failed screencast anddebug_urlraiseFerrum::Error. Errors that had no message or a misleading one say what's missing now [#557]set_behaviormoved frompage.downloadstocontext.downloadsandbrowser.downloads, as Chrome sets it for thewhole context.
browser.downloadsis the default context's,page.downloadslists only the page's downloads [#753]set_behaviortakes:allow_and_nameinstead of:allowAndName, and needssave_path:only for:allowand:allow_and_name[#753]Deprecated
:extensions,browser.add_extensionandbrowser.extensions, will be removed in 1.0. Use:init_scripts,browser.add_init_scriptandbrowser.init_scriptsnetwork.clear, will be removed in 1.0. Usenetwork.clear_trafficornetwork.clear_cache[#749]browser.reset, will be removed in 1.0. Usebrowser.contexts.reset[#748]Fixed
evaluateof a script that starts a navigation and returns an object raisedNoExecutionContextError, it returnsthe object now
evaluateandexecuteare released in the page, they stayed alive until itnavigated to another document
execution_id!on a frame, page or worker that went away, or on a browser that died, while ithad no execution context raises
NoExecutionContextErrorat once, it waited out the whole timeoutkeyboard.typeandnode.typetype\nin a string as Enter, it was droppedBrowser.newinterrupted while it cleans up, e.g. byTimeout.timeout, closes the socket, stops itsthreads and the browser process instead of leaking them [#738]
:ws_max_receive_sizeraisesDeadBrowserErrorthat names the limit [#739]browser.quitandrestartinterrupted while closing the connection to a hung browser, e.g. byTimeout.timeout,still stop the browser process [#740]
authorizewithout a block no longer warnsNoMethodErroron every request [#745]window.close(), drops its event callbacks instead of keeping themfor the rest of the browser's life [#750]
:process_timeoutbounds the TLS handshake of awss://connection too, a host that accepts the connection andnever answers raises
ConnectTimeoutErrorinstead of hanging [#741]:save_path, and a page sees its own when another page set the behavior. A new orclosed page no longer resets it, and a popup's download shows up on the page that opened it [#753]
Removed
page.close_connectionandworker.close_connection, a page's events stop once Chrome detaches it [#750]Network::AUTHORIZE_BLOCK_MISSING,authorizeno longer needs a block [#745]Target#page=, a private API Cuprite no longer needs, build pages withcreate_pageand set them up withon_pageBrowser::Options::BASE_URL_SCHEMA, useBASE_URL_SCHEMEStarget.window?andwindowsof a context and of the browser, usetarget.opener_id,await_page { ... }orpages(&:opener_id):js_errors, uncaught exceptions are inpage.consolewithsource: :exception, andpage.on(:console)yields them:pending_connection_errorsandPendingConnectionsError, usego_to!, it raisesNavigationTimeoutErrorcurrent_urlandcurrent_titleof pages and frames, useurlandtitle, orframe.page.urlfor the top windowfrom a frame
cookies.all, useto_a, ormap(&:name)for the namesflatten: false, every page shares the browser's websocket connectionFERRUM_DEBUG, useFERRUM_LOG=*:protocol_timeout,browser.protocol_timeout,browser.protocol_timeout=andFERRUM_PROTOCOL_TIMEOUT, they wereignored,
:timeoutbounds everything elsewait:ofclick,mouse.upandmouse.down, usenavigation_wait:.FERRUM_CLICK_WAITandFERRUM_GOTO_WAIT,use
FERRUM_NAVIGATION_WAITmode:andkeys:ofnode.click, usebutton: :rightorcount: 2, andmodifiers:mouse.scroll_by(x, y)andscroll_to(x, y), passx:andy:accessibility.enableanddisable, useaccessibility.enabled = true/falsegoto,go,reloadandreload!, usego_to,refreshandrefresh!frame.set_content, usecontent=node.scroll_into_view,node.axnodeandnode[name], usescroll,ax_nodeandproperty(name)contexts.each { |id, context| },eachyields the context, usecontext.idfor the idrequest_idof intercepted and auth requests,post_dataof requests, andtimestampandmonotonic_timeofNetwork::Error, useid,bodyandtimedisable_javascript,bypass_csp(enabled:),network.cache(disable:),offline_modeandemulate_network_conditions, usejavascript = false,bypass_csp =,cache =,offline = trueandthrottlebody, usehtml.typeandtype?ofNetwork::RequestandtypeofNetwork::Response, useresource_typeand
resource_type?Ferrum::NotImplementedError, nothing raises it sincenode.hoverworks"objectId"key toevaluateas a remote object, it is passed as a plain Hash now. Pass theFerrum::RemoteObjectfromevaluate_handlenode.find_position, usepinpoint, its offsets are measured from the center unlessposition: :topwait_for_navigation,wait_for_navigation!,wait_for_reload,wait_for_selector,network.wait_for_idle,wait_for_idle!,downloads.waitandnode.wait_for_stop_moving, useawait_navigation,wait_css,wait_xpath,wait_idle,page.await_downloadandwait_still. Positionalnetwork.idle?(n), passconnections:v0.21.0Compare Source
Added
page.javascript = true/falseandjavascript?turn the page's scripts on and off, there was no way back onnetwork.offline = true/falsetakes the page offline and back online,network.throttle(latency:, download:, upload:)slows it down. Each replaces the other's conditions, Chrome keeps one set of them
page.bypass_csp = true/falseandnetwork.cache = true/falseFerrum::Deadline.within(seconds) { ... }bounds every call the block makes with one budget,page.go_to,cookiesand
evaluateincluded.go_toraisesNavigationTimeoutErroronce it runs outtimeout:ongo_to,refresh,back,forward,clickandawait_navigationbounds the whole call with a singleFerrum::Deadlinecontext.target(id)returns the context's target with that idtimeout:onkeyboard.type,node.typeandmouse.movebounds all the keys or steps together, the pagetimeoutby default, raise it for a long text
context.await_page { ... }, andbrowser.await_pagefor the default context, runs the block andreturns the page it opens, in a tab or a window, or
nilif none opens in time.await_page!raisesFerrum::TimeoutErrorinstead. Passopener:to only get the pages opened by one pagepagesof a context and of the browser takes a block that selects targets, e.g.pages(&:opener_id)forthe pages opened by another page
go_to(url, referrer:)sets the referrer of that navigation only, the page's other requests don't carry itcookies.setacceptshttp_only:andsame_site:next tohttponly:andsamesite:, like the cookie's readerscookies[name, domain:, path:]picks one of the cookies sharing a namecontext.cookieswith every cookie in the context whatever its domain,browser.cookiesis the default context'snetwork.emulate(user_agent:, accept_language:, platform:, metadata:)overrides what the page reports in the requestheaders and in
navigator,platformhad no way to be set before, andmetadatakeeps the client hints Chromeotherwise stops sending once the user agent is overridden
go_to!,refresh!,back!andforward!raiseNavigationTimeoutError, aTimeoutErrornaming the requestsstill pending, when the page doesn't load in time
browser.off,window_bounds,window_bounds=,tracing,activateanddocument_sizereach the page like therest of its methods
await_*runs a block and waits for the event it triggers,wait_*polls a check.page.await_navigation { },context.await_page { }andpage.await_download { }return the navigation's result,the page or the download.
wait_css,wait_xpath,network.wait_idle,node.wait_stillandpage.wait_until { }return what they waited for. Every one returns
nilon timeout and has a!version that raisesTimeoutErrornode.hovermoves the mouse over the node, it raisedNotImplementedErrornode.pinpoint(x:, y:, position:)returns the point a click on the node lands on,xandyare an offset fromthe center or, with
position: :top, from the top-left corner. A single offset applies, and so does the offset of anode without a box
Changed
nilinstead oftrue,selfor Chrome's raw response:set_viewport,resize,stop,close,activate,execute,remove_script_on_new_document,dialog.accept/dismiss,network.intercept,clearandemulate,headers.add/set/clear,cookies.set/remove/clear/load,downloads.set_behavior,console.clear,browser.close/reset,context.dispose,contexts.disposeandworker.close.node.remove,select_fileandexecutereturn the node, like the other node commandsnode.click(offset:)andhover(offset:)measurexandyfrom the center by default, passposition: :topforthe top-left corner
browser.contexts.eachand theEnumerablemethods yield contexts instead of[id, context]pairsrefresh,backandforwardreturnnilwhen the page doesn't load in time instead of raising, userefresh!,back!andforward!to raisenetwork.idle?takesconnections:as a keywordclient.commandneeds atimeout:and has noasync: true, useclient.notifyto send without waiting, andbrowser.commanddefaults to the browser'stimeout30 seconds,
:protocol_timeoutno longer sets eithertimeoutwait:ofclick,mouse.upandmouse.downis renamed tonavigation_wait:,falseskips the waitgo_toshare one default,Page::NAVIGATION_WAIT, set byFERRUM_NAVIGATION_WAITpage.commanddoesn't takewait:anymore, wrap it inpage.await_navigationto wait for a navigation it starts.Passing
wait:orasync:to a command raisesArgumentError, they would be sent to the browser as parameterspage.eventispage.idleand holds aFerrum::Concurrency::Cell, not aConcurrent::Eventbrowser.targetsandcontext.targetsreturn a copy of the hash, it doesn't follow the targets that come and gogo_to,refreshand the script methods no longer restart the timeout for each step, onetimeoutcovers the whole callclick,mouse.move,keyboard.type,back,forward,wait_cssand node scripts share onetimeoutacross thecommands they send, they restarted it for each
page.on(:request),on(:auth)andon(:dialog)callbacks form a chain: they run in order and the rest are skippedonce one continues, responds to, aborts, accepts or dismisses, and an unhandled request is continued. They receive
only the object, not
indexandtotal, usehandled?to check whether a previous callback took it. A callbackthat holds a request to answer later gets it continued, and one registered after the handler no longer sees it
page.cookiesis the cookies the page sees, the ones sent to its URL and its frames' URLs, oreach(urls:). Itreturned every cookie in the context, use
browser.cookiesorbrowser.contexts[page.context_id].cookiesfor that.setandremovedefault to the page's host,clearkeeps other domains,store/loadare on the context onlyNoSuchPageErroris aNoSuchTargetErrornow, so rescuingNoSuchTargetErrorcovers a target Chrome no longerknows, like a closed page, as well as one Ferrum doesn't track
statements run and the last one's value is returned, and
Node#evaluatereturns nodes and dates, seeupgrading [#673]
onwith a raw CDP event yields only the params, not the callback's index and the total number of callbacksnode.clicktakesbutton:,count:andmodifiers:likemouse.click, and holds the keys ofkeyboard.holdwhenno
modifiers:are given. The mouse methods takemodifiers:as key names as well as a bitfieldmouse.scroll_byandscroll_totakex:andy:, an omitted one doesn't scroll along its axiskeyboard.modifiersandheld_modifiersare internal now, passmodifiers:as key namesDeprecated
target.window?, will be removed in 0.22. Usetarget.opener_id, it is set for a target another one openedwindowsof a context and of the browser, will be removed in 0.22. Useawait_page { ... }for the page a clickopens, or
pages(&:opener_id)for all of themcookies.all, will be removed in 0.22. Keyed by name, it kept one of the cookies sharing a name, useto_a, ormap(&:name)for the nameswait_for_navigationandwait_for_navigation!, will be removed in 0.22. Useawait_navigation(watch:)wait_for_reload, will be removed in 0.22. Useawait_navigation { ... }around the code that reloads the pagewait_for_selector, will be removed in 0.22. Usewait_cssorwait_xpathnetwork.wait_for_idleandwait_for_idle!, will be removed in 0.22. Usewait_idle,duration:isinterval:downloads.wait, will be removed in 0.22. Usepage.await_download { ... }node.wait_for_stop_moving, will be removed in 0.22. Usewait_stillconnectionstonetwork.idle?positionally, will be removed in 0.22. Passconnections:current_urlandcurrent_titleon pages and frames, will be removed in 0.22. Useurlandtitle, orframe.page.urlfor the top window from a frame,frame.urlis the frame's own:js_errors, will be removed in 0.22. Uncaught exceptions are inpage.consolewithsource: :exception, use it orpage.on(:console)instead:pending_connection_errorsandPendingConnectionsError, will be removed in 0.22. Usego_to!insteadUser-AgentandAccept-Languageset throughheaderschanging whatnavigatorreports, will stop in 0.22, wherethey are only sent with requests. Use
network.emulate(user_agent:, accept_language:)to override bothflatten: false, the option will be removed in 0.22 and every page will share the browser's websocket connectionFERRUM_DEBUG, will be removed in 0.22. UseFERRUM_LOG=*instead:protocol_timeout,browser.protocol_timeout,browser.protocol_timeout=andFERRUM_PROTOCOL_TIMEOUT, will beremoved in 0.22. They are ignored and warn,
:timeoutbounds everything elsewait:ofclick,mouse.upandmouse.down, will be removed in 0.22. Usenavigation_wait:insteadFERRUM_CLICK_WAITandFERRUM_GOTO_WAIT, will be removed in 0.22. UseFERRUM_NAVIGATION_WAITinsteadgoto,go,reloadandreload!, will be removed in 0.22. Usego_to,refreshandrefresh!frame.set_content, will be removed in 0.22. Usecontent=node.scroll_into_view, will be removed in 0.22. Usenode.scrollnode.axnode, will be removed in 0.22. Usenode.ax_nodenode[name], will be removed in 0.22. Usenode.property(name)contexts.each { |id, context| }, will be removed in 0.22.eachyields the contextrequest_idof intercepted and auth requests, will be removed in 0.22. Useid, likeRequest#idpost_dataof requests, will be removed in 0.22. Usebodydisable_javascript,bypass_csp(enabled:),network.cache(disable:),offline_modeandemulate_network_conditions, will be removed in 0.22. Usejavascript = false,bypass_csp =,cache =,offline = trueandthrottletimestampandmonotonic_timeofNetwork::Error, will be removed in 0.22. Usetime, which is now set for everyfailure, not only the ones the browser logs a message for
mode:andkeys:ofnode.click, will be removed in 0.22. Usebutton: :rightorcount: 2, andmodifiers:mouse.scroll_by(x, y)andscroll_to(x, y), will be removed in 0.22. Passx:andy:accessibility.enableanddisable, will be removed in 0.22. Useaccessibility.enabled = true/falsebody, will be removed in 0.22. Usehtml, it always returned the whole documenttypeandtype?ofNetwork::RequestandtypeofNetwork::Response, will be removed in 0.22. Useresource_typeandresource_type?, like the intercepted requests"objectId"key toevaluateas a remote object, will be removed in 0.22. Pass theFerrum::RemoteObjectfromevaluate_handlenode.find_position, will be removed in 0.22. Usepinpoint, its offsets are measured from the center unlessposition: :topFixed
Network::Request#timekeeps the fraction of a second, it was truncated to whole secondsBrowser.newthat failed or was interrupted while connecting left its connection and threads open, it closes them nowurlorws_urlhost blockedBrowser.newfor the OS connect timeout, it raisesFerrum::ConnectTimeoutError, aTimeoutError, afterprocess_timeoutnowbackon the first history entry reloaded the page, it returnsnilnowxvfb: truesometimes started before Xvfb was ready and exited at once withProcessTimeoutError, Ferrum waits for the display nowtracing.recordtimed out whenpage.on("Tracing.tracingComplete")was subscribed before its first callpage.command(method, wait:)ran a subclass override ofcommand, like Cuprite's, twiceevaluateof a result nested about 100 levels deep raised an opaqueBrowserErrorabout Chrome's CBOR stack limit,it raises
ResultTooDeepErrornow, aBrowserErrorthat says to return less or useevaluate_handleworker.closenever closed a dedicated worker, Chrome refuses to close it from outside, it closes itself nowpage.on(:request, &:continue)never continued the request, it calledcontinue(index, total)and the error wasdropped. Symbol procs and lambdas taking one argument get only the object now, for
:request,:response,:authand
:dialogAuthRequest#abortraisedBrowserErrorand left the page hanging, it cancels the auth challenge nowInterceptedRequest#navigation_request?andAuthRequest#navigation_request?always returnednil, they are truefor document requests now
evaluateraisedNoMethodErrorwhen a node inside aMaporSetwas also referenced elsewhere in the resultgo_tokept sending aRefererafterheaders.clearorheaders.sethad removed itheaders.clearkept sending the old headers until the nextaddorset, and kept the user agent and language theyset. Now it clears them in Chrome right away
headers.addandheaders.setreset a user agent or language set withnetwork.emulate, and made Chrome stopsending client hints, even for headers like
X-Trace. They touch the user agent and language only when given onepdf(path:)returnedtruewhilescreenshot(path:)andmhtml(path:)return the number of bytes written, now itreturns the byte count too
mouse.scroll_byandscroll_toanimated on a page withscroll-behavior: smoothin a Chrome without--disable-smooth-scrolling, so the position was mid-scroll when they returned. They scroll instantly nowat_css,css,at_xpathandxpathon a node inside an iframe raisedNodeNotFoundError, now they search thenode's own frame
Node#moving?returnedtruefor a node that wasn't moving andfalsefor one that was. Its default delay is now50ms instead of 10ms, which missed a slowly moving node, set it with
FERRUM_NODE_MOVING_CHECKNode#clickand#find_positionon a CSS-transformed node whose content quads can't be computed aimed by itsuntransformed size and could miss it, now they aim at the center of its bounding rect. An SVG node raised
JSON::GeneratorErrorthere [#695]Removed
#evaluate_async,#evaluate_funcand#evaluate_on, use#evaluateandNode#evaluate, andpage.await_navigation!(watch:) { }forevaluate_on'swait:[#673]FERRUM_JS_API[#673]permanent:ofheaders.add, it only kept aRefereroff the requests after the navigation, passreferrer:togo_toinstead.headers.add("X-Trace" => "1")works without braces now, it raisedArgumentErrorpage.referrerandpage.referrer=, passreferrer:togo_toinsteadMouse::CLICK_WAITandPage::GOTO_WAIT, usePage::NAVIGATION_WAITBrowser::Options::Base, Chrome is the only browser,Browser::Options::Chromehas everything it hadFerrum::ServerError, nothing raised it:browser_name, it only switched between Chrome-named defaults and raisedNotImplementedErrorfor anything else, set:browser_pathto run Opera or Edgecookie.sameparty?andsame_party?, Chrome dropped SameParty cookies and they always returnednilConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.