AngularJS - Watir not locating elements on login form

Silvio Correia's Avatar

Silvio Correia

11 Aug, 2016 09:28 PM

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. 1 Posted by Silvio Correia on 11 Aug, 2016 09:33 PM

    Silvio Correia's Avatar

    html code attached...

  2. Support Staff 2 Posted by Tasos Laskos on 13 Aug, 2016 07:52 AM

    Tasos Laskos's Avatar

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

  3. Support Staff 3 Posted by Tasos Laskos on 13 Aug, 2016 07:53 AM

    Tasos Laskos's Avatar

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

  4. 4 Posted by Silvio Correia on 19 Aug, 2016 05:21 PM

    Silvio Correia's Avatar

    Ok. I'll send.

  5. 5 Posted by Frank on 22 Aug, 2016 03:37 PM

    Frank's Avatar

    Any further updates on this issue?

  6. Support Staff 6 Posted by Tasos Laskos on 22 Aug, 2016 03:47 PM

    Tasos Laskos's Avatar

    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. 7 Posted by Frank on 22 Aug, 2016 05:53 PM

    Frank's Avatar

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

  8. Support Staff 8 Posted by Tasos Laskos on 24 Aug, 2016 12:18 PM

    Tasos Laskos's Avatar

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

  9. Support Staff 9 Posted by Tasos Laskos on 26 Aug, 2016 09:07 AM

    Tasos Laskos's Avatar

    Nightlies with PhanomJS 2.1.1 are up.

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

  10. 10 Posted by Silvio Correia on 21 Sep, 2016 06:54 PM

    Silvio Correia's Avatar

    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. Support Staff 11 Posted by Tasos Laskos on 21 Sep, 2016 09:43 PM

    Tasos Laskos's Avatar

    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. 12 Posted by Silvio Correia on 21 Sep, 2016 11:34 PM

    Silvio Correia's Avatar

    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. Support Staff 13 Posted by Tasos Laskos on 23 Sep, 2016 11:47 AM

    Tasos Laskos's Avatar

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

  14. Support Staff 14 Posted by Tasos Laskos on 28 Nov, 2016 03:26 PM

    Tasos Laskos's Avatar

    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