You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tested the issue with the latest version of the product
Issue Description
Expectation
I expect that if I wrap the call to the analyze function in a try catch statement or use a promise.catch, I would be able to catch any exception that is thrown by the function.
Actual
There are certain cases that can cause an uncatchable exception to be thrown by the function.
How to Reproduce
importAxeBuilderfrom"@axe-core/playwright";importplaywright= require("playwright");process.on("uncaughtException",(err)=>{console.error("An uncaught exception occurred: ",err);switch(err.message){case"page.evaluate: Execution context was destroyed, most likely because of a navigation":
console.error("The page execution context was destroyed. Attempting to continue...");break;default:
process.exit(1);}});(async()=>{constbrowser=awaitplaywright.chromium.launch({headless: false});constcontext=awaitbrowser.newContext();constpage=awaitcontext.newPage();console.info(`Loading page...`);page.goto("https://youtube.com");try{console.info(`Analyzing page...`);awaitnewAxeBuilder({ page }).analyze().catch((e)=>{console.error(`Error occurred when analyzing page: ${e}`);});}catch(e){console.error(`Error occurred when analyzing page: ${e}`);}console.info(`Loading page new page...`);awaitpage.goto("https://google.com");awaitbrowser.close();})();
Example output
Debugger attached.
Loading page...
Analyzing page...
An uncaught exception occurred: page.evaluate: Execution context was destroyed, most likely because of a navigation
at AxeBuilder.analyze (/Users/nscribano/Developer/go/src/bitbucket.org/atlassian/axe-scanner/node_modules/@axe-core/playwright/dist/index.js:236:10)
at /Users/nscribano/Developer/go/src/bitbucket.org/atlassian/axe-scanner/dist/src/index.js:26:50 {
name: 'Error'
}
The page execution context was destroyed. Attempting to continue...
Error occurred when analyzing page: Error: page.evaluate: Execution context was destroyed, most likely because of a navigation
Loading page new page...
Waiting for the debugger to disconnect...
Additional context
The "how to reproduce" code is a bit convoluted because the exception would not occur if I were to await the page.goto("https://youtube.com"); call. However, I have seen this bug happen a handful of times in a real environment where I have a service that is iterating across URLs and scanning them with axe-core/playwright. That bug is difficult to recreate consistently, but the code I've included above has the same effect. Either way, I would expect to be able to catch the exception that happens.
The text was updated successfully, but these errors were encountered:
Product
playwright
Product Version
4.7.3
Latest Version
Issue Description
Expectation
I expect that if I wrap the call to the analyze function in a try catch statement or use a promise.catch, I would be able to catch any exception that is thrown by the function.
Actual
There are certain cases that can cause an uncatchable exception to be thrown by the function.
How to Reproduce
Example output
Additional context
The "how to reproduce" code is a bit convoluted because the exception would not occur if I were to await the
page.goto("https://youtube.com");
call. However, I have seen this bug happen a handful of times in a real environment where I have a service that is iterating across URLs and scanning them with axe-core/playwright. That bug is difficult to recreate consistently, but the code I've included above has the same effect. Either way, I would expect to be able to catch the exception that happens.The text was updated successfully, but these errors were encountered: