Application run as admin

Best practices, code snippets for common functionality, examples, and guidelines.
msys_mg
Posts: 6
Joined: Wed Oct 26, 2016 7:55 am

Application run as admin

Post by msys_mg » Wed Oct 26, 2016 8:57 am

Hello there,
i have to setup a test solution, therefore i need first, before starting the application to test, a special tool who emulates a server. This tool must be startet as admin. (Right mouse click "run as admin"). So i need to input username and password for the local admin on the windows dialog.

How can i solve this with ranorex, any ideas?

Thanks
michael

jma
Posts: 107
Joined: Fri Jul 03, 2015 9:18 am

Re: Application run as admin

Post by jma » Thu Oct 27, 2016 1:22 pm

Hi,

Did you already try to record the scenario with the Ranorex Recorder? Are you able to recognize the UI of the Windows dialog? Alternatively, I would suggest logging in as administrator from the beginning in order you don't have to do the authentication during test execution.

msys_mg
Posts: 6
Joined: Wed Oct 26, 2016 7:55 am

Re: Application run as admin

Post by msys_mg » Thu Oct 27, 2016 2:00 pm

That doesn't work, the last entry in the recorder is the right click on the context menu.

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

Re: Application run as admin

Post by krstcs » Thu Oct 27, 2016 3:55 pm

Ranorex cannot see or interact with the elevation prompt from UAC, nor can any other application, this is a Windows security feature!

Your best bet is to lower the UAC threshold to the lowest setting. This does not turn UAC off, but it does allow elevation without asking for credentials, assuming your user has the appropriate credentials.

NOTE: Your local user MUST have the appropriate permission level/group membership in order to elevate both Ranorex and your AUT on the local system. Also, both Ranorex and the AUT should be started at the same level, as this is the only real way to ensure that they both have the same permissions and that Ranorex can interact correctly with the AUT. While there are some hacks to try to work around this, I would highly recommend not using them because they are not easy or guaranteed to work every time.
Shortcuts usually aren't...