How to bring browser to front?

651 views
Skip to first unread message

Ivan Chung

unread,
Sep 29, 2011, 2:54:06 AM9/29/11
to Watir General
Hi,

I have a batch file scheduled to kick off the command prompt then
execute the watir scripts .rb. It is having problem where the command
prompt window is in front of the browser. My scripts that has
autoit.send failed due to the browser is at background. How do i deal
with it?

I tried to use autoit.WinActivate('title') but does not seems to work
for me. May i know the title that using is from the html <title>..</
title>? Or is there other options that i can solve my problem?

-Ivan

Željko Filipin

unread,
Sep 29, 2011, 3:52:29 AM9/29/11
to watir-...@googlegroups.com
On Thu, Sep 29, 2011 at 8:54 AM, Ivan Chung <ivanc...@gmail.com> wrote:
> It is having problem where the command
> prompt window is in front of the browser. My scripts that has
> autoit.send failed due to the browser is at background.

This should do it:

browser.bring_to_front

Ivan Chung

unread,
Sep 29, 2011, 4:37:50 AM9/29/11
to Watir General
Isn't it only for IE? Unfortunately i am using FF

On Sep 29, 3:52 pm, Željko Filipin <zeljko.fili...@wa-research.ch>
wrote:

Joe Fl

unread,
Nov 3, 2011, 11:44:37 AM11/3/11
to Watir General
Hi,

Can anyone tell if there is a method for watir-webdriver that will
bring my firefox browser to the front?

I gave the above a try. No luck.

Joe

On Sep 29, 4:37 am, Ivan Chung <ivanchun...@gmail.com> wrote:
> Isn't it only for IE? Unfortunately i am using FF
>
> On Sep 29, 3:52 pm, Željko Filipin <zeljko.fili...@wa-research.ch>
> wrote:
>
>
>
>
>
>
>
> > On Thu, Sep 29, 2011 at 8:54 AM, Ivan Chung <ivanchun...@gmail.com> wrote:
> > > It is having problem where the command
> > > prompt window is infrontof thebrowser. My scripts that has
> > > autoit.send failed due to thebrowseris at background.

Dan

unread,
Nov 3, 2011, 2:17:23 PM11/3/11
to watir-...@googlegroups.com
You can likely use the windows API ShowWindow using the Win32API.  FindWindow will help you find the hwnd.

Joe Fleck

unread,
Nov 3, 2011, 2:20:42 PM11/3/11
to watir-...@googlegroups.com
I am using a MAC Pro so I don't think that will work.

Thank you for responding I do appreciate it.

joe

On Thu, Nov 3, 2011 at 2:17 PM, Dan <dfr...@gmail.com> wrote:
You can likely use the windows API ShowWindow using the Win32API.  FindWindow will help you find the hwnd.

Dan

unread,
Nov 3, 2011, 2:26:21 PM11/3/11
to watir-...@googlegroups.com
Oh, in that case maybe look at the ruby applescript gem.  I believe you can do the same thing with that on a MAC.  https://rubygems.org/gems/rb-appscript

Chuck van der Linden

unread,
Nov 3, 2011, 2:29:28 PM11/3/11
to Watir General
On Nov 3, 11:20 am, Joe Fleck <joeflec...@gmail.com> wrote:
> I am using a MAC Pro so I don't think that will work.
>
> Thank you for responding I do appreciate it.
>
> joe
>
>

Well I'd suggest you either:

a) post a question on a more general Ruby list (or SO) to see if
there are any gems that help do UI level automation/manipulation on a
Mac (similar to AutoIt or RAutomation on a Windows box)
b) Make friends with VirtualBox (or if you want to pay for them,
either Parallels or VMware-Fusion) and run the tests inside a Windows
VM)

option B lets you test on IE on the same system.
Reply all
Reply to author
Forward
0 new messages