One of our internal applications (written in angularjs) has a special error box appearing if javascript is disabled in the browser (using noscript), similar to the
Found an alternative solution/workaround - "NoScript Security Suite" firefox extension.
It disables javascript per-domain and, by default, it does it for all sites except listed in the whitelist. This makes the webdriver run without problems, open up a web page, then the extension disables javascript for this particular site and I see the contents of the noscript
tag.
Here's the protractor config:
'use strict';
var helper = require('./disabledJavascript.helper.js');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: helper.getFirefoxProfile(),
chromeOnly: false,
specs: [
'disabledJavascript.spec.js'
],
framework: 'jasmine',
allScriptsTimeout: 20000,
baseUrl: 'http://localhost:9001',
jasmineNodeOpts: {
showColors: true,
isVerbose: true,
includeStackTrace: true
}
};
where disabledJavascript.helper.js
contains:
'use strict';
var q = require('q');
var FirefoxProfile = require('firefox-profile');
exports.getFirefoxProfile = function() {
var deferred = q.defer();
var firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension('./test/e2e/disabledJavascript/noscript.xpi', function () {
firefoxProfile.encoded(function(encodedProfile) {
var capabilities = {
'firefox_profile' : encodedProfile,
'browserName': 'firefox'
};
deferred.resolve(capabilities);
});
});
return deferred.promise;
};
where noscript.xpi
is a downloaded "Noscript" extension.