You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,14 @@
2
2
3
3
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
5
+
## Unreleased [minor]
6
+
7
+
> Development of this release was supported by [Reset Tech](https://www.reset.tech).
8
+
9
+
### Added
10
+
11
+
- Add PDF file support in full DOM fetcher
12
+
5
13
## 10.4.0 - 2026-01-19
6
14
7
15
> Development of this release was supported by [Reset Tech](https://www.reset.tech).
response=awaitpage.goto(url,{waitUntil: 'load'});// Using `load` instead of `networkidle0` as it's more reliable and faster. The 'load' event fires when the page and all its resources (stylesheets, scripts, images) have finished loading. `networkidle0` can be problematic as it waits for 500ms of network inactivity, which may never occur on dynamic pages and then triggers a navigation timeout.
40
+
}catch(error){
41
+
if(error.message.includes('net::ERR_ABORTED')){
42
+
// Chrome may sometimes abort navigation for files such as PDFs.
43
+
// Do not throw for now; wait for the PDF interception handler to finish processing the response.
44
+
navigationAborted=true;
45
+
}else{
46
+
throwerror;
47
+
}
39
48
}
40
49
41
-
response=awaitpage.goto(url,{waitUntil: 'load'});// Using `load` instead of `networkidle0` as it's more reliable and faster. The 'load' event fires when the page and all its resources (stylesheets, scripts, images) have finished loading. `networkidle0` can be problematic as it waits for 500ms of network inactivity, which may never occur on dynamic pages and then triggers a navigation timeout.
50
+
// PDF interception handling
51
+
if(handled){
52
+
awaithandled;// Wait for the interception callback to finish processing the response
53
+
54
+
if(pdf.content){
55
+
return{
56
+
mimeType: 'application/pdf',
57
+
content: pdf.content,
58
+
};
59
+
}
60
+
61
+
if(pdf.status){// Status captured by CDP interception
62
+
thrownewError(`Received HTTP code ${pdf.status} when trying to fetch '${url}'`);
63
+
}
64
+
}
65
+
66
+
if(navigationAborted){
67
+
thrownewError(`Navigation aborted when trying to fetch '${url}'`);
68
+
}
42
69
43
70
if(!response){
44
71
thrownewError(`Response is empty when trying to fetch '${url}'`);
returnelement?.textContent.trim().length;// Ensures element exists and contains non-empty text, as an empty element may indicate content is still loading
59
-
},
60
-
{timeout: config.waitForElementsTimeout},
61
-
selector,
62
-
));
63
-
64
-
// We expect all elements to be present on the page…
client.send('Fetch.enable',{patterns: [{urlPattern: '*',requestStage: 'Response'}]});// Intercept all responses before Chrome processes them, allowing to capture PDF content before it's handled by the PDF viewer
@@ -85,5 +95,27 @@ describe('Full DOM Fetcher', function () {
85
95
awaitexpect(fetch(url,['.content'],{ ...config,navigationTimeout: timeout})).to.be.rejectedWith(`Timed out after ${timeout/1000} seconds when trying to fetch '${url}'`);
0 commit comments