cdp icon indicating copy to clipboard operation
cdp copied to clipboard

Protocol version

Open ziflex opened this issue 6 years ago • 5 comments

Hi!

I wonder what's the current version of the CDP protocol the library is using now? Since the protocol is still in flux, I need the number to properly stick to a particular version of Chrome.

ziflex avatar Aug 23 '19 16:08 ziflex

Hi, they were pulled from the JSON in ChromeDevTools/devtools-protocol on Jul 10, so that should be r674637.

But on that note, unless you're using bleeding edge methods, there shouldn't be much difference when using the latest protocol definition and running a few versions old Chrome 😄.

I could add the protocol version somewhere, e.g. commit message, maybe Version() on the client or a comment in a file, etc. Would that be helpful, any preference?

mafredri avatar Aug 24 '19 09:08 mafredri

PS. For best compatibility, pulling the protocol from the running browser (http://localhost:9222/json/protocol) and generating the cdp protocol from that would be the best option. Unfortunately, at the time of writing, this is not very straight forward.

I've been planning on moving to Go modules, and making a few adjustments to the protocol generator (cdpgen) to accommodate for this.

mafredri avatar Aug 24 '19 09:08 mafredri

Hi, they were pulled from the JSON in ChromeDevTools/devtools-protocol on Jul 10, so that should be r674637.

But on that note, unless you're using bleeding edge methods, there shouldn't be much difference when using the latest protocol definition and running a few versions old Chrome 😄.

I could add the protocol version somewhere, e.g. commit message, maybe Version() on the client or a comment in a file, etc. Would that be helpful, any preference?

I think version in README would be just fine.

The problem I'm facing is that the protocol works weird with new versions of Chrome. Not always, but its work is not consistently good or bad. Completely random issues appear here or there.

Therefore, I would like to know the version of the library in order to understand what range of browsers should be supported well. (if such exist at all)

ziflex avatar Aug 25 '19 00:08 ziflex

The problem I'm facing is that the protocol works weird with new versions of Chrome. Not always, but its work is not consistently good or bad. Completely random issues appear here or there.

That's weird, in my experience the protocol definition either works or it doesn't. So for example, if you're using a newer protocol definition and and older Chrome, and trying to run a command that's not supported on that version, you will get an error. It shouldn't cause any weird behavior.

From the cdp-packages perspective, there really is no difference between Chrome versions, the difference is only what commands are issued and with what parameters (i.e. the generated protocol definitions are really just a thin wrapper).

If you can give more specific examples of failures, and maybe point to example code that fails sporadically, I could look into it.

mafredri avatar Aug 25 '19 09:08 mafredri

I can't say that there is a pattern. Same operations may fail just randomly.

I guess because of if puppeteer uses specific version of Chrome.

ziflex avatar Aug 29 '19 19:08 ziflex