autologin script
Hi,
I recently discover your project and it seems really powerfull. However, I have a problem when I'm trying to connect my website.
The authentification require 3 inputs and a click after each one is filled.
I have tried 3 scripts (2 rb and 1js) and I think this one (js) works better :
document.getElementById('input1').value = '123456';
document.getElementById('btn').click();
document.getElementById('input2').value = '1234';
document.getElementById('btn').click();
document.getElementById('input3').value = 'abcd';
document.getElementById('btn').click();
It seems to work but the check pattern match on error page not on home. When I log in from my browser, I go throught 1 first page (page1.do) which check password, ... and it normally throw me on a second page (page2.do).
I think the check option doesn't let time for redirection.
Have you got an idea about that ?
Regards,
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
Support Staff 1 Posted by Tasos Laskos on 05 Oct, 2017 10:36 AM
Javascript doesn't work like that, that script operates within the browser as if it was part of the webpage, so once the page changes the script is no longer there.
You need to switch to a Ruby login script, that operates on the browser level and will let you navigate accordingly.
2 Posted by Ranus on 05 Oct, 2017 11:02 AM
Hi, thank you for your answer.
I've tried with Ruby script but can't figure how to make it work. For now I can pass arguments an click but it seems that the page1.do can't validate all of it.
I use browser.execute_script because password is on readonly.
Have you got an other idea ?
Support Staff 3 Posted by Tasos Laskos on 13 Oct, 2017 09:23 AM
Can you try avoiding JS at all? Use only the Watir interface and see if that makes any difference.
Btw, without direct access it's basically impossible for me to know what's going on in these cases.
4 Posted by Ranus on 13 Oct, 2017 03:02 PM
Yes, I can avoid JS I succeded with PostMan.
I need to call first page with GET to get cookie,
Second in POST to pass datas
I tried with this kind of script but doesn't seems to work.
I'm sorry but developpment versions are not available on internet and we can't test on production version.
Thank you for your help
5 Posted by Ranus on 20 Oct, 2017 01:17 PM
Hi, I've finnally succeded with a Ruby script.
I realized that home.do could be reachwith a post call, so my script is like this :
Thank you for your help and your project :)
Ranus closed this discussion on 20 Oct, 2017 01:19 PM.