how to get user input and use it

Best practices, code snippets for common functionality, examples, and guidelines.
aaf1983
Posts: 1
Joined: Fri Mar 11, 2016 12:25 pm

how to get user input and use it

Post by aaf1983 » Fri Mar 11, 2016 12:33 pm

Hey

i am new in the application. So maybe it is a very simple question.

I would like the Ranorex is opening a browser and visit the login page of my website (i did)
Now I want Ranorex to wait for the user name and password from the user and only then continue the script\process.


could you guide me how to do it?

Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: how to get user input and use it

Post by odklizec » Mon Mar 14, 2016 8:43 am

Hi,

I think the easiest way to achieve what you want is to use WaitFor Exists/NotExist method.

Simply add an element (confirmation window, status text, etc), which typically appears after user's login, to repository. Then Drag&Drop the repo element from repository to recording/code module and from the appeared menu select WaitFor action. Then adjust its parameter to Exists or Not Exists. Hope this helps?
Last edited by odklizec on Tue Mar 15, 2016 2:28 pm, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: how to get user input and use it

Post by krstcs » Tue Mar 15, 2016 2:26 pm

Maybe I have this wrong, but you want to have the test WAIT ON USER INPUT before it continues? Is that right?

If so, you are doing it wrong. Test automation should not have user input. That is the point of automation. What happens when you need to run 4 tests at the same time, what about 10, or 100 (like some of us)? What about when you need to start running the tests at night when no one is actually there?

If this really is the case then you need to re-think your approach. If you are going to automate, then automate all of it.

If you have issues with having the password saved in the code because it's a real person's password, then change to using a test user with a known password and have the user only be available on your test system, not your production system.
Shortcuts usually aren't...