Skip to content

Commit 85dd343

Browse files
authored
Den 446 Add scroll_to_bottom to dendrite browser (#88)
1 parent 111a1a0 commit 85dd343

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

dendrite/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
fmt = "<green>{time: HH:mm:ss.SSS}</green> | <level>{level: <8}</level>- <level>{message}</level>"
2020

21-
logger.add(sys.stderr, level="DEBUG", format=fmt)
21+
logger.add(sys.stderr, level="INFO", format=fmt)
2222

2323

2424
__all__ = [

dendrite/async_api/_core/dendrite_browser.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,25 @@ async def goto(
259259

260260
return active_page
261261

262+
async def scroll_to_bottom(
263+
self,
264+
timeout: float = 30000,
265+
scroll_increment: int = 1000,
266+
no_progress_limit: int = 3,
267+
):
268+
"""
269+
Scrolls to the bottom of the current page.
270+
271+
Returns:
272+
None
273+
"""
274+
active_page = await self.get_active_page()
275+
await active_page.scroll_to_bottom(
276+
timeout=timeout,
277+
scroll_increment=scroll_increment,
278+
no_progress_limit=no_progress_limit,
279+
)
280+
262281
async def _launch(self):
263282
"""
264283
Launches the Playwright instance and sets up the browser context and page manager.

dendrite/sync_api/_core/dendrite_browser.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,25 @@ def goto(
234234
raise IncorrectOutcomeError(f"Incorrect navigation, reason: {e}")
235235
return active_page
236236

237+
def scroll_to_bottom(
238+
self,
239+
timeout: float = 30000,
240+
scroll_increment: int = 1000,
241+
no_progress_limit: int = 3,
242+
):
243+
"""
244+
Scrolls to the bottom of the current page.
245+
246+
Returns:
247+
None
248+
"""
249+
active_page = self.get_active_page()
250+
active_page.scroll_to_bottom(
251+
timeout=timeout,
252+
scroll_increment=scroll_increment,
253+
no_progress_limit=no_progress_limit,
254+
)
255+
237256
def _launch(self):
238257
"""
239258
Launches the Playwright instance and sets up the browser context and page manager.

0 commit comments

Comments
 (0)