This repository was archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
UnknownError: javascript error: document unloaded while waiting for result #1283
Copy link
Copy link
Closed
Labels
Description
Hello I have a problem with “UnknownError: javascript error: document unloaded while waiting for result ” . The error appears in all sets of tests where the login to the site. At every the third or fourth launch. Failed always the first test using the login(); function. So I use a special test to work around this. But it is never been beautiful solution. First page of Google on request: "UnknownError: javascript error: document unloaded while waiting for result", did not help.
What can I do with this?
The necessary information:
Log of error:
UnknownError: javascript error: document unloaded while waiting for result
(Session info: chrome=36.0.1985.143)
(Driver info: chromedriver=2.10.267521,platform=Windows NT 6.3 x86_64)
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.27 seconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03' System info: os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.7.0_67'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities
[{platform=WIN8_1, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome,
chrome={userDataDir=C:\%UserAppData%\Local\Temp\scoped_dir4736_31820},
rotatable=false, locationContextEnabled=true, version=36.0.1985.143,
takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false,
handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true,
webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
at new bot.Error (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:109:18)
at Object.bot.response.checkResponse (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9)
at C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:277:20
at C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1243:15
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1539:20)
at notify (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:362:12)
at notifyAll (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:331:7)
at resolve (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:309:7)
at fulfill (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:429:5)
at C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1406:10
==== async task ====
WebDriver.executeScript()
at webdriver.WebDriver.schedule (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:268:15)
at webdriver.WebDriver.executeAsyncScript (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:496:15)
at Protractor.waitForAngular (C:\%UserAppData%\Roaming\npm\node_modules\protractor\lib\protractor.js:887:22)
at login (C:\%ProjectFolder%\E2E-test\support\LoginPage.js:13:17)
at null. (C:\%ProjectFolder%\E2E-test\spec\Login page\signin.js:12:47)
at C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\jasminewd\index.js:94:14
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1539:20)
at webdriver.promise.ControlFlow.runEventLoop_ (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1404:8)
at wrapper [as _onTimeout] (timers.js:261:14)
==== async task ====
Asynchronous test function: it()
at null. (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\jasminewd\index.js:93:33)
at null. (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\async-callback.js:45:37)
at jasmine.Block.execute (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1174:17)
at jasmine.Queue.next_ (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)
at null._onTimeout (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2199:18)
at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
==== async task ====
Error
at null. (C:\%ProjectFolder%\E2E-test\spec\Login page\signin.js:12:5)
at jasmine.Env.describe_ (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:913:21)
at jasmine.Env.describe (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:898:15)
at describe (C:\%UserAppData%\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:658:27)
at Object. (C:\%ProjectFolder%\E2E-test\spec\Login page\signin.js:5:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
E2E-test\protractor.conf.js
//https://github.com/jintoppy/protractor-html-screenshot-reporter
var HtmlReporter = require('protractor-html-screenshot-reporter'),
FileSystem = require('fs');
exports.config =
{
seleniumAddress: 'http://localhost:4444/wd/hub',
suites: {
specs: __dirname + '/spec/**/*.js',
login: __dirname + '/spec/Login page/*.js',
},
baseUrl:'http://localhost:5555/',
params:
{
login:
{
user: 'login',
password: 'password'
},
basePath: __dirname,
baseUrl:'http://localhost:5555/'
},
onPrepare: function ()
{
browser.driver.manage().window().maximize();
jasmine.getEnv().addReporter(
new HtmlReporter(
{
baseDirectory: __dirname + '/result'
}));
},
capabilities:
{
browserName : 'chrome',
'chromeOptions':
{
args: ['--test-type']
}
},
allScriptsTimeout: 30000
};
E2E-test\spec\Login page\signin.js:
var basePath = browser.params.basePath;
var baseUrl = browser.params.baseUrl;
var loginPage = require(basePath + '/support/LoginPage.js');
describe('Login page; login tests:', function ()
{
beforeEach(function()
{
browser.get('#/login');
browser.waitForAngular();
});
it('Failed test', function ()
{
loginPage.login(browser.params.login.user, browser.params.login.password);
browser.waitForAngular();
}, 10000);
it('Try input invavid login format', function ()
{
loginPage.userName.clear();
loginPage.userName.sendKeys('InvalidNameFormat');
expect(element.all(by.css('span[class*="error"]')).get(0).isDisplayed()).toBe(true);
}, 10000);
//Several similar tests
it('Try input correct login/password', function ()
{
loginPage.login(browser.params.login.user, browser.params.login.password);
browser.waitForAngular();
expect(browser.getCurrentUrl()).toContain('#/branches');
}, 10000);
});
E2E-test\support\LoginPage.js:
var LoginPage = function()
{
this.userName = element(by.id('email'));
this.userPassword = element(by.id('password'));
this.forgotPasswordButton = element(by.css('[ng-href*="reset"]'));
this.submitButton = element.all(by.css('[type="submit"]')).get(0);
this.login = function(userName, password)
{
element(by.id('email')).clear();
element(by.id('email')).sendKeys(userName);
element(by.id('password')).clear();
element(by.id('password')).sendKeys(password);
element.all(by.css('[type="submit"]')).get(0).click();
browser.waitForAngular();
}
};
module.exports = new LoginPage();