I'm using Playwright Java version 1.28.1 to test my company's website. I'm trying to navigate to the website using the following code:
page.waitForLoadState(LoadState.DOMCONTENTLOADED);
page.navigate("https://my-company-website.com/");
The problem is that the website also loads ads at the same time as the main app, and sometimes these ads take a long time to load. This prevents the DOMContentLoaded event from firing, and I get a TimeoutError:
com.microsoft.playwright.TimeoutError: Error { message='Timeout 30000ms exceeded.
=========================== logs ===========================
navigating to "https://my-company-website.com/", waiting until "load".
Is there a way to fix this error? Can I tell Playwright to not wait for the page to fully load? Or can I trigger the page load as soon as a specific HTML DOM element becomes visible?
Any help would be appreciated.