Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
1  
You can execute JS with selenium, so this will work until original function source is re-loaded. –  yoosiba Jan 23 '12 at 10:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.