Protractor: Headless and GetCurrentUrl non angular timeout

Created on 19 Feb 2019  路  4Comments  路  Source: angular/protractor

Hi, I'm trying to test a external link with a non angular page, and get the url, but I always get a timeout error.

Bug report

  • Node Version: v8.10.0
  • Protractor Version: 5.4.2
  • Angular Version: ``6.1.5..
  • Browser(s): chrome
  • Operating System and Version windows

  • Protractor configuration file

const {
  SpecReporter
} = require('jasmine-spec-reporter');
const {
  SELENIUM_PORT
} = require('./gulpfile');
exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      args: ['--headless', '--disable-gpu', '--lang=pt-BR']
    }
  },
  seleniumAddress: `http://localhost:${SELENIUM_PORT}/wd/hub`,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function () {}
  },
  onPrepare() {
    browser.ignoreSynchronization = true;
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    jasmine.getEnv().addReporter(new SpecReporter({
      spec: {
        displayStacktrace: true
      }
    }));
  },
  SELENIUM_PROMISE_MANAGER: false
};
  • Test
it(`Rac - Card deve redirecionar para a p谩gina de help`, async () => {
      await browser.get('https://google.com.br');
      const teste = await browser.getCurrentUrl();
      expect(teste).toEqual('https://google.com.br');
});
  • Output from running the test
C:\workspace\SL-MeuChecklist\checklist-thf>protractor protractor.conf.js
[14:03:39] I/launcher - Running 1 instances of WebDriver
[14:03:39] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Spec started
Mock limpo - resetAllRequests feito com sucesso
Criado mockResponseWithDefaultHeaders

  HomePage

    A莽玫es dos cards
      脳 Rac - Card deve redirecionar para a p谩gina de help
        - Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
            at ontimeout (timers.js:482:11)
            at tryOnTimeout (timers.js:317:5)

**************************************************
*                    Failures                    *
**************************************************

1) HomePage A莽玫es dos cards Rac - Card deve redirecionar para a p谩gina de help
  - Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

Executed 1 of 8 specs (1 FAILED) (7 SKIPPED) in 34 secs.
[14:04:20] I/launcher - 0 instance(s) of WebDriver still running
[14:04:20] I/launcher - chrome #01 failed 1 test(s)
[14:04:20] I/launcher - overall: 1 failed spec(s)
[14:04:20] E/launcher - Process exited with error code 1
  • Steps to reproduce the bug
    You only run the test

Most helpful comment

year after and no answer?
@mr-mateus i was able to workaround it with

const teste = await browser.driver.getCurrentUrl();

don't know why calling the driver directly make it works

All 4 comments

Try disable waitAngular

@ZeekoZhu I just tried, but didn't work

year after and no answer?
@mr-mateus i was able to workaround it with

const teste = await browser.driver.getCurrentUrl();

don't know why calling the driver directly make it works

year after and no answer?
@mr-mateus i was able to workaround it with

const teste = await browser.driver.getCurrentUrl();

don't know why calling the driver directly make it works

OMG,you saved my day! thanks

Was this page helpful?
0 / 5 - 0 ratings