I'm trying to extract data from a website using Selenium. On random occasions, the page will do a client-side redirect with window.location. How can I disable this?
I've tried redefining the property in JavaScript during the Chrome DevTools Protocol Page.addScriptToEvaluateOnNewDocument event (before any remote JavaScript is run), but this throws an exception because .location is not reconfigurable. window is also impossible to reconfigure.
Network.setBlockedURLs.