I need to disable a particular JavaScript function of the main application for which I am creating automated tests using Selenium WebDriver.
Is there a way to do this?
Selenium is not designed to play in this way. Still on Selenium you can run your own JavaScript functions. In this case you can try override function which you want to disable (e.g. function functionWhichYouWantToBeDisabled(){return null;}
). In this way it not be disabled but removed/changed functionality temporally. All what I say is more in theory level, I will not surprise if this won't work (I never try anything similar).
Much easier way is completely disable JavaScript on browser. For example if you testing with Firefox you can create custom Firefox profile with disabled JavaScript.