login_script not working

Javier Vidal's Avatar

Javier Vidal

23 Nov, 2017 02:18 PM

Hi,

I'm trying to use login_script to login into my website, but the script always times out:

[2017-11-23 14:49:15 +0100] Session: [utilities#exception_jail:428] [Watir::Exception::UnknownObjectException] timed out after 30 seconds, waiting for #<Watir::TextField: located: false; {:id=>"login", :tag_name=>"input"}> to be located

I'm using the nightly build in macOS High Sierra.

This is the command I use to run arachni:

arachni --output-debug=3 https://uiv5.platform161.com/ --plugin=login_script:script=login.rb --report-save-path=output`

This is my login.rb script:

browser.goto 'https://uiv5.platform161.com/#/testcost/login'

sleep(10)
form = browser.form( class: 'login-form' )
browser.screenshot.save ('screenshot_login.png')

browser.text_field( id: 'login' ).set 'username'
browser.text_field( id: 'pswd' ).set 'password'

form.submit

sleep(10)

framework.options.session.check_url     = browser.url
framework.options.session.check_pattern = 'Javier Vidal'

This is the complete output:
https://gist.github.com/javiervidal/834090bd260d3c4c9539df63ae95b60...

and this the error.log:
https://gist.github.com/javiervidal/834090bd260d3c4c9539df63ae95b60...

It seems that the Angular application is not properly executed. Please see screenshot_login.rb.

I've tried with a standalone Watir / PhantomJS script and the Angular application loads fine. This is the script I run directly from the command line, without arachni:

require 'watir'
browser = Watir::Browser.new :phantomjs
browser.goto 'https://uiv5.platform161.com/#/testcost/login'

sleep(10)
form = browser.form( class: 'login-form' )
browser.screenshot.save ("screenshot_watir_login_form.png")

browser.text_field( id: 'login' ).set 'javier.vidal'
browser.text_field( id: 'pswd' ).set 'HXXqDjsATthnTdCc3o2a'

form.submit

sleep(10)
browser.screenshot.save ("screenshot_watir_dashboard.png")

Please see screenshot_watir_*.png files.

Any clue of what is going on?

Thank you very much,

  1. 1 Posted by Javier Vidal on 23 Nov, 2017 02:25 PM

    Javier Vidal's Avatar

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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