diff --git a/test/integration/localization.test.js b/test/integration/localization.test.js
index e7cc64e90b6127ac4ed993ca4450c54cb1b886b9..8c92ee161136fd287a6bc878783432770c2edf89 100644
--- a/test/integration/localization.test.js
+++ b/test/integration/localization.test.js
@@ -49,6 +49,9 @@ describe('Localization', () => {
         // After switching languages, make sure Apple sprite still exists
         await rightClickText('Apple', scope.spriteTile); // Make sure it is there
 
+        // Remounting re-attaches the beforeunload callback. Make sure to remove it
+        driver.executeScript('window.onbeforeunload = undefined;');
+
         const logs = await getLogs();
         await expect(logs).toEqual([]);
     });