@@ -734,10 +734,22 @@ export default class Interpreter extends EventEmitter {
734734 return allResults ;
735735 }
736736
737- await page . evaluate ( ( ) => window . scrollTo ( 0 , document . body . scrollHeight ) ) ;
737+ await page . evaluate ( ( ) => {
738+ const scrollHeight = Math . max (
739+ document . body . scrollHeight ,
740+ document . documentElement . scrollHeight
741+ ) ;
742+
743+ window . scrollTo ( 0 , scrollHeight ) ;
744+ } ) ;
738745 await page . waitForTimeout ( 2000 ) ;
739746
740- const currentHeight = await page . evaluate ( ( ) => document . body . scrollHeight ) ;
747+ const currentHeight = await page . evaluate ( ( ) => {
748+ return Math . max (
749+ document . body . scrollHeight ,
750+ document . documentElement . scrollHeight
751+ ) ;
752+ } ) ;
741753 const currentResultCount = allResults . length ;
742754
743755 if ( currentResultCount === previousResultCount ) {
@@ -1024,10 +1036,22 @@ export default class Interpreter extends EventEmitter {
10241036
10251037 // Wait for content to load and check scroll height
10261038 await page . waitForTimeout ( 2000 ) ;
1027- await page . evaluate ( ( ) => window . scrollTo ( 0 , document . body . scrollHeight ) ) ;
1039+ await page . evaluate ( ( ) => {
1040+ const scrollHeight = Math . max (
1041+ document . body . scrollHeight ,
1042+ document . documentElement . scrollHeight
1043+ ) ;
1044+
1045+ window . scrollTo ( 0 , scrollHeight ) ;
1046+ } ) ;
10281047 await page . waitForTimeout ( 2000 ) ;
1029-
1030- const currentHeight = await page . evaluate ( ( ) => document . body . scrollHeight ) ;
1048+
1049+ const currentHeight = await page . evaluate ( ( ) => {
1050+ return Math . max (
1051+ document . body . scrollHeight ,
1052+ document . documentElement . scrollHeight
1053+ ) ;
1054+ } ) ;
10311055 const heightChanged = currentHeight !== previousHeight ;
10321056 previousHeight = currentHeight ;
10331057
0 commit comments