Hey Andrea,
I just discovered this project and I must say: thanks, this is awesome! :heart_eyes:
I tried to use the very very new Page.printToPdf. The local protocol.json doesn't have the method yet so I used CDP({ remote: true }.... The problem I encountered is that it triggers the version fetching and the regex for Chrome is a strict /^Chrome\// which does not work with Chrome with the --headless option. When I start it like this, the browser variable is equal to HeadlessChrome/59.0.3067.0.
I patched it locally with /^Chrome\// to test and printToPdf worked but maybe you want to fix that differently like adding a new else if.
WDYT?
Thanks Hubert, I really appreciate it! :)
Yes, this was related to this issue but it seems that it has been fixed now. Thanks for reporting.
Fixed and pushed a new version on NPM ([v0.19.0]).
FYI: you don't really need the proper protocol if you're aware of the capabilities of the implementation, you can simply use the other syntax, for example:
client.send('Page.printToPdf')
In fact, you should avoid the remote option unless really needed, because (at least for Chrome/ium) it involves 2 HTTP requests.
Anyway I've fetched the latest version of 'protocol.json' as well which includes Page.printToPdf.
Thanks for the new version and for the client.send() tip :+1:
Most helpful comment
Thanks Hubert, I really appreciate it! :)
Yes, this was related to this issue but it seems that it has been fixed now. Thanks for reporting.
Fixed and pushed a new version on NPM ([v0.19.0]).
FYI: you don't really need the proper protocol if you're aware of the capabilities of the implementation, you can simply use the other syntax, for example:
In fact, you should avoid the
remoteoption unless really needed, because (at least for Chrome/ium) it involves 2 HTTP requests.Anyway I've fetched the latest version of 'protocol.json' as well which includes
Page.printToPdf.