AngularJS - Watir not locating elements on login form

Hello Tasos!

We have an app that uses AngularJS and the login script can't find the username (id=username) and password (id=password),

Login form:

<form class="ng-pristine ng-valid" autocomplete="false">
<div class="form-group has-feedback">
<label class="control-label" for="cpf">Usuário</label>
<div class="input-group">
<span class="input-group-addon">
<span class="fa fa-user"></span>
</span>
<input id="username" class="form-control ng-pristine ng-valid ng-empty ng-touched" type="text" submit="" uk-model-update-on="" autocomplete="false" mask-clean="true" mask-restrict="reject" mask="999.999.999-99" ng-model="vm.autenticacao.userName" placeholder="000.000.000-00" autofocus="" style="">
</div>
<span class="fa form-control-feedback" aria-hidden="true"></span>
</div>
<div class="form-group has-feedback">
<label class="control-label" for="senha">Senha</label>
<div class="input-group">
<span class="input-group-addon">
<input id="password" class="form-control ng-pristine ng-valid ng-empty ng-touched" type="password" submit="" uk-model-update-on="" autocomplete="nope" ng-model="vm.autenticacao.password" style="">
</div>
<span class="fa form-control-feedback" aria-hidden="true"></span>
<div class="text-right">
</div>
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="form-group">
<button class="btn btn-primary btn-block center-block" ng-click="vm.entrar()" uk-submit="" type="submit">
<span class="fa fa-arrow-right right"></span>
Entrar
</button>
</div>
</form>

Login script:

browser.goto 'http://URLAPP'

sleep(15)

browser.text_field(:id => "password").send_keys 'password@!#'
browser.element(:xpath => "//*[text()='entrar']").click

sleep(15)

framework.options.session.check_url     = 'http://URL_check'
framework.options.session.check_pattern = /Bem vindo/

error msg:

Session: [Watir::Exception::UnknownObjectException] unable to locate element, using {:id=>"username"...

I tried id, xpath, css and still not finding the elements.

Thanks in advance

  1. html code attached...

  2. Are you sure that the error corresponds to that login script?
    I don't see anything being located via a username id.

  3. Also, I'm going to need the full error please.

  4. Ok. I'll send.

  5. Any further updates on this issue?

  6. It's almost impossible to debug this without access to the application, although it could be a browser incompatibility with AngularJS -- in which case you'll need to wait for the upgrade.

  7. I asked because I ran into a similar issue with Arachni's use of PhantomJS 1.9.2 and compatibility with AngularJS 2.

  8. Please subscribe to this issue to monitor the upgrade progress: https://github.com/Arachni/arachni/issues/764

  9. Nightlies with PhanomJS 2.1.1 are up.

    Give them a try and let me know how they do.

  10. Hi Tasos,

    I'm still having issues with angularJS. Can I send you my logs privately? This is verry important to solve, because we are planning to replace Hp webinspect to Arachni. Thanks a lot for your help.

  11. I'd love a chance to debug this but I can't do it via logs, I'm afraid I'm going to need access to the webapp.

  12. I'm sorry but it's not possible to access the webapp. Because, it's protected app by the Brazilian gov. Thanks for your hey

    Thanks for your support

  13. Any chance you can setup a demo that's identical to how the page behaves?

  14. Closing due to lack of feedback, please re-open if you want to add more information.

  15. Tasos Laskos closed this discussion on 28 Nov, 2016 03:26 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac