Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 1198dde

Browse files
committed
fix(navigation): use empty html data urls for page resets instead of about:blank
Except on internet explorer, which does not allow data urls. Closes #1023.
1 parent f0e7984 commit 1198dde

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

lib/protractor.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ var STACK_SUBSTRINGS_TO_FILTER = [
2323
'protractor/lib/'
2424
];
2525

26+
var DEFAULT_RESET_URL = 'data:text/html,<html></html>';
27+
2628
/*
2729
* Mix in other webdriver functionality to be accessible via protractor.
2830
*/
@@ -841,6 +843,11 @@ var Protractor = function(webdriverInstance, opt_baseUrl, opt_rootElement) {
841843
*/
842844
this.params = {};
843845

846+
/**
847+
* The reset URL to use between page loads.
848+
*/
849+
this.resetUrl = DEFAULT_RESET_URL;
850+
844851
/**
845852
* Information about mock modules that will be installed during every
846853
* get().
@@ -981,7 +988,7 @@ Protractor.prototype.get = function(destination, opt_timeout) {
981988
return this.driver.get(destination);
982989
}
983990

984-
this.driver.get('about:blank');
991+
this.driver.get(this.resetUrl);
985992
this.driver.executeScript(
986993
'window.name = "' + DEFER_LABEL + '" + window.name;' +
987994
'window.location.replace("' + destination + '");');
@@ -991,7 +998,7 @@ Protractor.prototype.get = function(destination, opt_timeout) {
991998
this.driver.wait(function() {
992999
return self.driver.executeScript('return window.location.href;').
9931000
then(function(url) {
994-
return url !== 'about:blank';
1001+
return url !== self.resetUrl;
9951002
}, function(err) {
9961003
if (err.code == 13) {
9971004
// Ignore the error, and continue trying. This is because IE

lib/runner.js

+8
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ Runner.prototype.setupGlobals_ = function(driver) {
167167
browser.params = this.config_.params;
168168
protractor.setInstance(browser);
169169

170+
driver.getCapabilities().then(function(caps) {
171+
// Internet Explorer does not accept data URLs, which are the default
172+
// reset URL for Protractor.
173+
if (caps.get('browserName') === 'internet explorer') {
174+
browser.resetUrl = 'about:blank';
175+
}
176+
});
177+
170178
// Export protractor to the global namespace to be used in tests.
171179
global.protractor = protractor;
172180
global.browser = browser;

0 commit comments

Comments
 (0)