Skip to content

Issue: Stuck on Last Page During Screenshot Capture #6

@helcone

Description

@helcone

Description:

The program encounters an error when taking screenshots on the last page (Page 248, Index 470) of a Kindle book. Instead of navigating to metadata creation, it becomes stuck, continually taking screenshots. The issue appears related to the inability to properly navigate past the last page.

Details:

Index: 470
Page: 248
Total Pages: 248
Screenshot Path: out/B0CHVWN7QG/pages/470-248.png
Error Message:

unable to navigate to next page; breaking... locator.click: Target page, context or browser has been closed
Call log:
  - waiting for locator('.kr-chevron-container-right')

node:internal/process/esm_loader:48
      internalBinding('errors').triggerUncaughtException(
                                ^

locator.textContent: Target page, context or browser has been closed
    at getPageNav (/home/user/Documents/kindle-ai-export/src/extract-kindle-book.ts:173:8)
    at main (/home/user/Documents/kindle-ai-export/src/extract-kindle-book.ts:258:27)
    at <anonymous> (/home/user/Documents/kindle-ai-export/src/extract-kindle-book.ts:450:1)

Steps to Reproduce:

Run npx tsx src/extract-kindle-book.ts.
It reaches the final page (248 of 248).
Program attempts to navigate further and gets stuck in an infinite screenshot loop.

Expected Behavior: After reaching the last page, the program should proceed to metadata creation and gracefully exit without trying to navigate further.

Potential Cause: The issue may be caused by an unsuccessful attempt to click on a navigation element (.kr-chevron-container-right) on the last page, which might be unavailable or causing a context closure.

I am not really good at coding but this happened on both mac and linux as well I tried to use bith methods headless and with the GUI browser. Tell me how can I help to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions