Fix: capture current page URL to reflect JavaScript navigation and add test for delayed redirects. ref #1268

This commit is contained in:
ntohidi
2025-12-02 13:00:54 +01:00
parent b36c6daa5c
commit 07ccf13be6
2 changed files with 124 additions and 0 deletions

View File

@@ -1023,6 +1023,12 @@ class AsyncPlaywrightCrawlerStrategy(AsyncCrawlerStrategy):
final_messages = await self.adapter.retrieve_console_messages(page)
captured_console.extend(final_messages)
###
# This ensures we capture the current page URL at the time we return the response,
# which correctly reflects any JavaScript navigation that occurred.
###
redirected_url = page.url # Use current page URL to capture JS redirects
# Return complete response
return AsyncCrawlResponse(
html=html,