I have a script (inside <script></script> tags) that is being executed every time I load a page. Is it possible to remove an WebElement before the page being loaded in the WebDriver to prevent that script from executing?
I am thinking of something in the lines of:
Somehow get the raw HTML code (perhaps get source or something), remove the part (with selenium or parser), "inject" the edited code back into Selenium (Firefox WebDriver or maybe PhantomJS) and finally execute it for all pages on that website.
Is it possible to do that or is this perhaps impossible by design?