Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
How to access AngularJS Controller in a E2E test using Protractor

I have an AngularJS application on which I'm performing E2E tests. I want to access my web page's scope object's properties but I can't do so.

I tried doing this in two ways but both the times I got the error 'angular is not defined'

The first way I did was -

browser.executeAsyncScript(function (callback) {
  var scopes = angular.element(document.querySelectorAll('[ng-app]')).scope();
  callback(scope);
  //var scopes = angular.element(document.getElementById('nextbtn')).scope();
}).then(function (output) {
  console.log(output);
});

The second option I tried -

browser.executeScript("angular.element(document.getElementById('nextbtn')).scope().setCurrentStep({ name: 'DepProfile', inst: 0, owner: 'tp' })");

Both times the same error - 'angular not defined'. Can anyone help, what am I missing on? Why can't I access the angular modal?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda