GoogleChromeLabs / chromium-bidi

Implementation of WebDriver BiDi for Chromium
https://googlechromelabs.github.io/chromium-bidi/
Apache License 2.0
87 stars 30 forks source link

Implement `browsingContext.print` (print to PDF) #518

Open sadym-chromium opened 1 year ago

sadym-chromium commented 1 year ago

Implement Add browsingContext.print command by jgraham · Pull Request #363 · w3c/webdriver-bidi.

CDP method: Page.printToPDF. Spec: https://w3c.github.io/webdriver-bidi/#command-browsingContext-print

Tracking

thiagowfx commented 1 year ago

@sadym-chromium shrinkToFit does not have a CDP equivalent. What do we do in these situations? File a FR against CDP?

sadym-chromium commented 1 year ago

What do we do in these situations?

In general there are 3 options:

  1. Implement in CDP.
  2. Implement on top of existing CDP functionality + some extra logic.
  3. Roll back the spec part.
thiagowfx commented 1 year ago
  1. Implement in CDP.

How can we do so? This was also suggested by @whimboo on https://github.com/web-platform-tests/wpt/pull/38931#issuecomment-1468350079

Could you give me a pointer to the CDP repo?

sadym-chromium commented 1 year ago
  1. Implement in CDP.

How can we do so? This was also suggested by @whimboo on web-platform-tests/wpt#38931 (comment)

Could you give me a pointer to the CDP repo?

sent you PM

sadym-chromium commented 1 year ago

@thiagowfx FYI there are bunch of new failing tests in WPT: https://github.com/GoogleChromeLabs/chromium-bidi/pull/625/files

thiagowfx commented 1 year ago

Test fails:

  bidiMapper:mapperDebug:CDP  sent ▸ {
  "id": 11,
  "method": "Page.navigate",
  "params": {
    "url": "data:application/pdf;base64,JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PC9DcmVhdG9yIChDaHJvbWl1bSkKL1Byb2R1Y2VyIChTa2lhL1BERiBtMTE2KQovQ3JlYXRpb25EYXRlIChEOjIwMjMwNjEyMjEwNjM4KzAwJzAwJykKL01vZERhdGUgKEQ6MjAyMzA2MTIyMTA2MzgrMDAnMDAnKT4+CmVuZG9iagozIDAgb2JqCjw8L0xlbmd0aCAwPj4gc3RyZWFtCgplbmRzdHJlYW0KZW5kb2JqCjIgMCBvYmoKPDwvVHlwZSAvUGFnZQovUmVzb3VyY2VzIDw8L1Byb2NTZXQgWy9QREYgL1RleHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUldPj4KL01lZGlhQm94IFswIDAgMjI2NzcuMTE5IDE3MDA4LjA4XQovQ29udGVudHMgMyAwIFIKL1N0cnVjdFBhcmVudHMgMAovUGFyZW50IDQgMCBSPj4KZW5kb2JqCjQgMCBvYmoKPDwvVHlwZSAvUGFnZXMKL0NvdW50IDEKL0tpZHMgWzIgMCBSXT4+CmVuZG9iago1IDAgb2JqCjw8L1R5cGUgL0NhdGFsb2cKL1BhZ2VzIDQgMCBSPj4KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAxNSAwMDAwMCBuIAowMDAwMDAwMjAyIDAwMDAwIG4gCjAwMDAwMDAxNTUgMDAwMDAgbiAKMDAwMDAwMDM3NiAwMDAwMCBuIAowMDAwMDAwNDMxIDAwMDAwIG4gCnRyYWlsZXIKPDwvU2l6ZSA2Ci9Sb290IDUgMCBSCi9JbmZvIDEgMCBSPj4Kc3RhcnR4cmVmCjQ3OAolJUVPRgo=",
    "frameId": "A45327FAB30B9B82E7B22502D73B7520"
  },
  "sessionId": "9371436D303A35CD0D25C2B137D48C64"
} +0ms
  bidiMapper:mapperDebug:CDP  received ◂ {
  "id": 11,
  "result": {
    "frameId": "A45327FAB30B9B82E7B22502D73B7520",
    "loaderId": "4C7ADCE66AA34C1EE27626ABB37C38EA",
    "errorText": "net::ERR_ABORTED"
  },
  "sessionId": "9371436D303A35CD0D25C2B137D48C64"
} +0ms
FAILED                                   [100%]

Accessing the URL manually works though.

devAtQ commented 1 year ago

When will this feature be released? And will this support generating pdf files from large html files?