Context:
- Playwright Version: 1.18.1
- Operating System: Mac
- Node.js version: 16.13.2
- Browser: Chromium
My app retrieves content from all frames of websites. Occasionally, for some websites, this does not work, and worse, it is not even possible to handle the resulting error and just ignore the frame. In the following example, the code breaks when trying to access the first child frame (meaning: execution just seems to stop).
Is there a way to either circumvent this error, and get the content, or detecting and handling the error, so that the script can finish?
const browser = await chromium.launch();
const page = await browser.newPage();
try {
await page.goto("http://www.ihr-sanitaetshaus-goslar.de/",{ waitUntil: 'networkidle',timeout: 5000});
}
catch (error) {
console.log("Timeout!")
}
child_frames = page.mainFrame().childFrames()
console.log("child_frames length:",child_frames.length)
for(frame of child_frames) {
try {
console.log("Trying to get frame content");
content = await frame.content();
}
catch(e) {
console.log("frame problem");
}
}
await browser.close();
Context:
My app retrieves content from all frames of websites. Occasionally, for some websites, this does not work, and worse, it is not even possible to handle the resulting error and just ignore the frame. In the following example, the code breaks when trying to access the first child frame (meaning: execution just seems to stop).
Is there a way to either circumvent this error, and get the content, or detecting and handling the error, so that the script can finish?