Bring Browser to the foreground

Ranorex Studio, Spy, Recorder, and Driver.
Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Bring Browser to the foreground

Post by Pixi6s » Thu Jun 07, 2012 7:20 pm

Hello,

I am looking into using Windows Scheduler to run an Ranorex exe on my runtime machine. It starts up fine but it doesn't automatically put the browser in the foreground so the first clicks fail and the script fails. When I run from a cmd prompt the browser is brought to the foreground automatically and I don't have this issue.

I have tried using Focus on the browser DOM and that didn't work.

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Bring Browser to the foreground

Post by Support Team » Fri Jun 08, 2012 1:53 pm

Just a quick hint: Try calling EnsureVisible on the DOM element instead of Focus.

Regards,
Alex
Ranorex Team

Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: Bring Browser to the foreground

Post by Pixi6s » Fri Jun 08, 2012 3:54 pm

I did try that as well after my post and it didn't work. Do I do Focus and then EnsureVisible?

Knowing EnsureVisible should work I will mess with it more.

thanks
Sierra

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Bring Browser to the foreground

Post by Support Team » Mon Jun 11, 2012 1:42 pm

Hi,
Do I do Focus and then EnsureVisible?
No, EnsureVisible should work, do you have used the EnsureVisible method of your WebDocument?

Regards,
Markus
Ranorex Support Team

Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: Bring Browser to the foreground

Post by Pixi6s » Mon Jun 11, 2012 2:27 pm

With Ensure Focus I can see that it tries to give the browser focus, in the start bar it starts blinking orange like it needs focus, but it doesn't actually bring it to the foreground so it cannot, say, type in the text boxes.

Any other ideas?
Sierra

Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: Bring Browser to the foreground

Post by Pixi6s » Mon Jun 11, 2012 3:24 pm

I open the browser, wait for it to load in, then I have EnsureFocus on the Browser Dom. Even if I minimize everything and set the scheduler to run, the cmd prompt that comes up to run the executable will retain focus with the browser behind it. The browser will be blinking to try and get focus.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Bring Browser to the foreground

Post by Support Team » Tue Jun 12, 2012 3:04 pm

Hi,

Do you mean EnsureVisible?
The browser will be blinking to try and get focus.
Could it be that some kind of a message box is poped up?
Do you have already tried to click on the windows task bar to bring the browser in foreground?

Regards,
Markus
Ranorex Support Team