0

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.

1
  • 2
    If you don't need that specific JS file for functionality, you can block it entirely using CDP Network.setBlockedURLs. Commented Aug 24 at 15:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.