How to Disable Selenium JS

Selenium lets you test your portable programs on your development computer. Portable device programmers don't have access to all mobile devices. Selenium provides Java and Windows developers with the ability to test code for all devices to improve the quality of their software releases. If you need to troubleshoot errors in Selenium, disabling JavaScript helps you isolate the errors.

Instructions

    • 1

      Open the Selenium programming software. Open your mobile project. Click "File" and "New" to create a new file that you'll use to disable JavaScript.

    • 2

      Copy and paste the following code to disable JavaScript:
      Selenium.prototype.doDisableJavascript = function() {
      setJavascriptPref(false);
      };

    • 3

      Save the file and name it with a ".js" extension such as "javascriptpreferences.js." The code file is added to your project.

    • 4

      Open your code file for the Web page on which you want to disable JavaScript. Add the following code to disable JavaScript on the page:
      jsprefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
      jsprefs.setBoolPref("javascript.enabled", bool);

Related Searches:

Comments

Related Ads

Featured