Repository navigation
ref(browser): read browser details over CDP and ask /json/version only for url: - #651
Merged
Merged
Conversation
… a startup window
…y for the url: websocket Browser data came from /json/version over HTTP, which ws_url: and local launches didn't need and which some services answer without a User-Agent (browserless v2), so headers.add sent a nil user agent and failed with Invalid parameters (rubycdp/cuprite#300). Browser#start now reads it from Browser.getVersion for every browser, and /json/version is only used to find the websocket url for url:. The version readers on Browser::Process are removed in favor of Browser#version.
…nts don't ask /json/version Ferrum used to call /json/version before connecting with ws_url:, so / claimed a pending Chrome with the same query and /devtools/browser/<id> fell back the same way when / took its id. Ferrum now connects to / directly, so / always starts a new Chrome and a pending one is claimed only by its id.
This was referenced Oct 18, 2026
This was referenced Oct 18, 2026
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.
What
Ferrum reads browser details (user agent, versions) over CDP with
Browser.getVersionfor every browser, local or remote./json/versionis only asked whenurl:is given, to find the websocket url.Why
User-Agentout of/json/version, soheaders.addsentNetwork.setUserAgentOverridewith a nil user agent and Chrome answeredInvalid parameters(Adding Header using browserless 2 / empty user agent cuprite#300).ws_url:and local launches already know the websocket url, so the HTTP call only added a failure point: a service without an HTTP endpoint couldn't be used withws_url:at all./json/versionfails,NoWebSocketUrlErrorsaid nothing about why. A missing token, a full service and a wrong url all looked the same.Changes
Browser#startsetsdefault_user_agentfromBrowser.getVersion.Processasks/json/versiononly forurl:, and the version parsing is gone from it.Browser::Process#default_user_agent,#browser_version,#protocol_version,#v8_versionand#webkit_version. UseBrowser#default_user_agentandBrowser#version.NoWebSocketUrlErrornames the HTTP status, e.g.`/json/version` there answered 429 Too Many Requests, and exposes it as#status.ws_url:clients no longer leave a pending Chrome behind, so the driver claims pending Chromes by id only:/always starts a new one, and the query matching and taken-id fallback are gone.resetcan't isolate tests on a browser that came up with a startup window, as browserless's does, and why Ferrum won't work around it.Testing
/json/versionhas noUser-Agent,ws_url:works through a proxy that hangs up on/json/version, and the 401 message names the status. Each fails without its change.-race.url:andws_url:each start exactly one Chrome, and headers work.