@d-zero/puppeteer-scroll 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/scroll-all-over.js
CHANGED
|
@@ -11,14 +11,14 @@ export async function scrollAllOver(page, options) {
|
|
|
11
11
|
const interval = options?.interval ?? 300;
|
|
12
12
|
let currentScrollY = 0;
|
|
13
13
|
let scrollHeight = await page.evaluate(() => document.body.scrollHeight);
|
|
14
|
-
while (currentScrollY < scrollHeight) {
|
|
14
|
+
while (Math.ceil(currentScrollY) < Math.ceil(scrollHeight)) {
|
|
15
15
|
[currentScrollY, scrollHeight] = await page.evaluate(() => {
|
|
16
16
|
// Move the scroll position to the bottom of the page.
|
|
17
17
|
globalThis.scrollBy(0, document.documentElement.clientHeight);
|
|
18
18
|
// Return the current scroll position.
|
|
19
19
|
return [
|
|
20
|
-
globalThis.scrollY + globalThis.innerHeight,
|
|
21
|
-
document.body.scrollHeight,
|
|
20
|
+
Math.ceil(globalThis.scrollY + globalThis.innerHeight),
|
|
21
|
+
Math.ceil(document.body.scrollHeight),
|
|
22
22
|
];
|
|
23
23
|
});
|
|
24
24
|
options?.logger?.(currentScrollY, scrollHeight, 'Scrolling');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/puppeteer-scroll",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Scroll function for puppeteer",
|
|
5
5
|
"author": "D-ZERO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,10 +24,13 @@
|
|
|
24
24
|
"clean": "tsc --build --clean"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@d-zero/shared": "0.
|
|
27
|
+
"@d-zero/shared": "0.8.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"
|
|
30
|
+
"puppeteer": "24.9.0"
|
|
31
31
|
},
|
|
32
|
-
"
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"puppeteer": "24.8.2"
|
|
34
|
+
},
|
|
35
|
+
"gitHead": "4e9cc7b87e0fef91b6f2d4edfb66ca9134b2491b"
|
|
33
36
|
}
|