This PR improves the reliability of page navigation in the collect function by better handling timeouts.
Changes
Implements Promise.race to timeout initial navigation after 10 seconds. If the navigation does not complete within this time, the code will automatically attempt to navigate again with the waitUntil: 'domcontentloaded' option. This prevents very slow pages from causing total failures.
After initial load, allows collecting partial data even if timeouts occur. Previously timeouts triggered an error and automatically stopped the program.
Increases default timeout from 30s to 35s for additional time to navigate.
This version enhances page navigation reliability by implementing a timeout mechanism for the fillForms function using Promise.race. If fillForms() doesn't complete within a specified time, it exits gracefully, allowing the program to continue. It checks if the page is closed before interacting with it and handles the "Execution context was destroyed" error gracefully.
This PR improves the reliability of page navigation in the collect function by better handling timeouts.
Changes
Promise.race
to timeout initial navigation after 10 seconds. If the navigation does not complete within this time, the code will automatically attempt to navigate again with the waitUntil: 'domcontentloaded' option. This prevents very slow pages from causing total failures.Promise.race
. IffillForms()
doesn't complete within a specified time, it exits gracefully, allowing the program to continue. It checks if the page is closed before interacting with it and handles the "Execution context was destroyed" error gracefully.Testing
Other Improvements
navigateWithTimeout
function for better readability.