Open browser opens browser into background when run from Jenkins

Ranorex Studio, Spy, Recorder, and Driver.
TimoL
Posts: 46
Joined: Thu Sep 13, 2018 3:08 pm

Open browser opens browser into background when run from Jenkins

Post by TimoL » Wed Apr 01, 2020 12:57 pm

I have Jenkins running on IE. Jenkins starts a test case which opens Chrome, but it opens behind the IE window. I have tried Invoke action EnsureVisible() for the dom object, but it does not bring the Chrome window front. And same problem exists with Firefox - also it starts behind the IE and stays there.

Problem does not exist when run from Ranorex Studio. How to get the new browser window foreground without minimizing IE?

Ranorex version is 9.3.1 and Ranorex plugin in Jenkins 1.0.2

TimoL
Posts: 46
Joined: Thu Sep 13, 2018 3:08 pm

Re: Open browser opens browser into background when run from Jenkins

Post by TimoL » Thu Apr 02, 2020 1:28 pm

Invoke action - Focus() seems to work.

Vega
Posts: 222
Joined: Tue Jan 17, 2023 7:50 pm

Re: Open browser opens browser into background when run from Jenkins

Post by Vega » Thu Apr 02, 2020 8:34 pm

Can you confirm that Jenkins is running as a process and not a service? Jenkins runs as a service by default and a service just does not have the needed permissions for automation.

Each action by default should try to do EnsureVisible on the object, so my first guess is permissions.
Note that because Jenkins or the nodes executing the CI jobs normally are started as Windows services, they do not have sufficient rights to start UI-applications. Ensure that Jenkins is not started as a service on the master or on the slave nodes where the Ranorex automation should be triggered.
Source: Integrate Automated Testing Into Jenkins

Hope this helps!

TimoL
Posts: 46
Joined: Thu Sep 13, 2018 3:08 pm

Re: Open browser opens browser into background when run from Jenkins

Post by TimoL » Fri Apr 03, 2020 4:25 am

Jenkins is running as process. But this Invoke action Focus() solved the problem. Thanks.

TimoL
Posts: 46
Joined: Thu Sep 13, 2018 3:08 pm

Re: Open browser opens browser into background when run from Jenkins

Post by TimoL » Thu May 28, 2020 2:15 pm

The problem has returned - the browser opens again behind all other programs and Invoke action Focus() does not help anymore. There's admin rights and Jenkins is run as a process. What could be tried next?

Vega
Posts: 222
Joined: Tue Jan 17, 2023 7:50 pm

Re: Open browser opens browser into background when run from Jenkins

Post by Vega » Mon Jun 08, 2020 7:09 pm

Did anything change to cause this issue to come back? Have you tried invoke action: focus on the browser form object instead of the DOM?

Also are all browsers open to the same domain / page? If so you may need to specify within your RxPath which browser you are specifically looking for. A Ranorex snapshot that shows everything in the environment at the point of failure would be helpful.

hope this helps

TimoL
Posts: 46
Joined: Thu Sep 13, 2018 3:08 pm

Re: Open browser opens browser into background when run from Jenkins

Post by TimoL » Thu Jul 02, 2020 2:41 pm

I don't remember anymore that was Windows / Ranorex / browser updated. There's no other browsers open than IE with Jenkins UI. The test opens one Internet page with Chrome. I tried to set focus on form object instead of dom, but it didn't help.

First actions after open browser was set value and then mouse click. When I added an additional mouse click of one text element in the beginning, it brings the Chrome window to the front. So seems the problem has been solved now.