diff --git a/test/web/puppeteer.mjs b/test/web/puppeteer.mjs
index cc818209c78d52b3dbaf94614d1cd9252eb0bb27..2412e015346d540d377b2adf4a28e63166669d33 100644
--- a/test/web/puppeteer.mjs
+++ b/test/web/puppeteer.mjs
@@ -80,8 +80,6 @@ if (!config.browser) {
     const failures = await page.evaluate(() => document.getElementById('mocha-stats').querySelector('li.failures em').textContent);
     const duration = await page.evaluate(() => document.getElementById('mocha-stats').querySelector('li.duration em').textContent);
     
-    const error = await page.evaluate(() => document.getElementById('mocha-errors').textContent);
-
     console.log('Tests passed:', passes);
     console.log('Tests failed:', failures);
     console.log('Duration:', duration);
@@ -92,23 +90,23 @@ if (!config.browser) {
     }
     
     await page.screenshot({ path: 'screenshot.png' });
-    await browser.close();
 
     const failuresAsInt = parseInt(failures);
-    if (error.length > 0 || failuresAsInt > 0) {
-        console.error('Tests failed: ', error);
+    if (failuresAsInt > 0) {
+        console.error('Tests failed');
 
         await page.evaluate(() => {
             document.querySelectorAll('.test.fail').forEach((node) => {
                 console.log(node.textContent);
             });
         });
-        
+
+        await browser.close();
         process.exit(1);
     } else {
+        await browser.close();
         console.log('Tests passed');
     }
 
 
-
 })();
\ No newline at end of file