Ranorex not launching app as admin

Ranorex Studio, Spy, Recorder, and Driver.
dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Ranorex not launching app as admin

Post by dmconsulting1 » Mon Nov 22, 2021 7:07 pm

The automation is running via the Ranorex agent. It installs the application just fine, but when it launches the application it isn't launching as admin, so none of the commands execute. I am using the exact same startup routine I use for the build validation suite and it runs just fine. I'm just using a simple Run Application. What am I doing wrong?
runApplication.png


UI elements in your 'WPF' AUT can’t be identified because it couldn’t be instrumented automatically. Restart all Ranorex tools and the AUT with the same privileges, preferably as an administrator
You do not have the required permissions to view the files attached to this post.

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

Re: Ranorex not launching app as admin

Post by odklizec » Tue Nov 23, 2021 11:53 am

Hi,

Is Ranorex Studio started as admin? If so, make sure there is also enabled option "Use UIALauncher..." in Settings >> Advanced tab.
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

dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Tue Nov 23, 2021 7:36 pm

Ranorex isn't calling the agent, DevOps is. I am using the Release Pipeline
devOpsTasks.png
The Use UIALauncher is enabled
useUiaLauncher.png
The powershell script is just running the command line argument using variables for the build number and related directories.
You do not have the required permissions to view the files attached to this post.

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

Re: Ranorex not launching app as admin

Post by odklizec » Tue Nov 23, 2021 7:53 pm

Well, in this case, I believe that the DevOps self hosted agent must be started as administrator? And then any app started via such agent should be started with elevated privileges as well? This, however, is not an “one click” solution task ;) Please check this discussion about how to run DevOps agent as administrator… https://stackoverflow.com/questions/541 ... ive-mode-i
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

dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Mon Nov 29, 2021 4:52 pm

I am digging into the DevOps side of things today, but here is the part that is making me crazy. We have 2 avenues. We have the standard DevOps build pipeline the creates a build, then runs the build validation test (BVT) that takes the built exe, installs it, then runs through a few basic tests to make sure the build does things. That works.

I created a Release pipeline using most everything from the build pipeline, only it doesn't create a build, it used the last successful build. It runs the installer just fine, but it fails when it launches the app. It's no different than how it launches the app for the BVT.

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

Re: Ranorex not launching app as admin

Post by odklizec » Mon Nov 29, 2021 5:19 pm

Hi,

I'm afraid, this is more a DevOps-related issue and something you will have to discuss with DevOps folks? It's hard to tell what's wrong without seeing the pipeline and error message (if there is any?). Have you checked the pipeline log for possible error messages?
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

dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Mon Nov 29, 2021 11:45 pm

The only error I am seeing is Ranorex complaining of not having sufficient rights.

UI elements in your 'WPF' AUT can’t be identified because it couldn’t be instrumented automatically. Restart all Ranorex tools and the AUT with the same privileges, preferably as an administrator. Exception while setting-up managed injection endpoint: System.Threading.ThreadAbortException: Thread was being aborted.

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

Re: Ranorex not launching app as admin

Post by odklizec » Tue Nov 30, 2021 8:17 am

Hi,

As I suggested above, is the DevOps agent started as administrator (use windows shortcut with Admin privileges option)? In this case, all apps started via DevOps agent, should be started in admin mode as well. However, I'm not quite sure how it is in case of Ranorex agents, which may be located on another machine?

BTW, why are you complicate things by using Ranorex agents inside DevOps environment? Ranorex agents are meant to be used in case you don't have CI in place and you want to quickly test something on another machine. In case of fully featured CI, it's better to call the test directly via CI environment, avoiding Ranorex remote execution. This simply adds another level of complexity, which I personally would definitely avoid, in case of available CI system ;)
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

User avatar
doke
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: Ranorex not launching app as admin

Post by doke » Tue Nov 30, 2021 9:29 am

Your script-path in the run-ranorex step refers to Run-Ranorex.ps1 ( with some arguments on next line)

My guess is you should modify this powershell script so it will run the compiled Rx as admin

Regards,
Don

dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Tue Nov 30, 2021 5:21 pm

Ok, I'm not sure what you mean about complicating things using the Ranorex agent.

Here is my setup, if there is a better way, PLEASE let me know.

I have an industrial PC that runs our application. I have the Ranorex agent installed on that PC.

As part of our build process, once a build is successful, it is copied to the agent PC. Once the build is copied to the agent PC, the test suite is called by the command line argument to run the test suite.

The test suite installs the build, then launches the app, runs a few basic steps within the app, then closes the app.

Once the test is finished, the PDF report is copied to the build directory and the build is market as Passed/Failed


Again, if there is a less complicated wait to do it, feel free to fill me in. This is how I've been doing it for over 2 years and for the most part it has worked. But now all of a sudden, it seems Ranorex has lost it's mind and can no longer see objects it has seen before and is complaining of elevated rights.

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

Re: Ranorex not launching app as admin

Post by odklizec » Wed Dec 01, 2021 11:19 am

Hi,

Well, I'm not quite sure if it's best, but here is what I'm doing on our DevOps setup.

Basically, I have two pipelines. First (build pipeline) obtains sources from GIT and builds the test project (in some cases also app under test) and publishes all build artifacts (publish artifacts plugin). Then there is second pipeline (test pipeline), which is triggered by successful build. This one downloads published artifacts on target PC (VM with installed DevOps agent) and starts the test (via CmdLine action). And once the test is finished, it publishes the test results.

You are doing the build and transfer of files via Ranorex and its remote agent. My solution gets sources, builds solution, transfer the files and start the test via DevOps pipeline. Ranorex way may be a bit easier to use, but honestly, I somehow think that DevOps agent is better tested and much more appropriate way how to do things in CI environment? ;)
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

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Ranorex not launching app as admin

Post by Stub » Wed Dec 01, 2021 11:46 am

We do much the same as you, dmconsulting1, albeit with a bespoke mechanism built upon MSBuild that pre-dates our use of Ranorex by an entire decade. So it's years older than DevOps etc.

Our build machine receives and processes a build request. If successful it sends a test request over to our Ranorex machine, which uses a Ranorex Test Suite to install and test the build, sending pass/fail results on down the line. We don't use Ranorex Agents or DevOps at any stage - yet.

So if all was well until recently, what changed recently on the testing machine? Any group policy changes that might be getting in the way, that kind of thing?

dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Wed Dec 01, 2021 2:54 pm

As far as what changed, that seems to be the million dollar question as things were working before the holiday weekend on the BVT and now it isn't. I am using a released build of the software and the automation hasn't changed in months.

I don't understand how you are running tests on a remote machine without using the agent. We aren't using the agent to copy files. only to run the tests. DevOps does the build, the file copy and the command line to start the test.
devOpsOutput.png
So the agent is only used to run the automation which is what it's supposed to do. But for whatever reason it doesn't seem to like the Run Application step. The Run Ranorex step is a command line passed to the agent.
You do not have the required permissions to view the files attached to this post.

User avatar
doke
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: Ranorex not launching app as admin

Post by doke » Wed Dec 01, 2021 4:42 pm

Hi Dmconsulting,

please note: Ranorex prefers to run as admin.
That Rx was running before without admin , and currenlty says it has problems does not mean you need these admin rights.
I get these messages also on occasions but thats not most of the time not causing tests to fail (reboot helps)

You state:
-build has not changed,
-automation hasn't changed.

What about your Clienmachine ? is this still the same ? (Do you reboot client on regular basis ? diskspace ? windows updates ?)

Furthermore: Could you share the exact failure ?

Regards,

Don

dmconsulting1
Posts: 169
Joined: Fri Nov 08, 2019 3:23 pm

Re: Ranorex not launching app as admin

Post by dmconsulting1 » Wed Dec 01, 2021 9:06 pm

Here is the test run. It starts the application, logs in as administrator, then a "Configuration Updater" window displays. The automation should unselect the check box and click OK, but is says it can't.

ranorexFailure.png
You do not have the required permissions to view the files attached to this post.