How to keep the Watir browser run on the backend?

30 views
Skip to first unread message

watirQ

unread,
Apr 10, 2019, 8:42:13 AM4/10/19
to Watir General
Experts 

Each time when use .goto or open a new tab, the browser window will lump to the frontend of the screen. How to keep the Watir browser run on the backend, so that will  not interrupt other works

Thanks

rajagopalan madasami

unread,
Apr 10, 2019, 8:45:37 AM4/10/19
to watir-...@googlegroups.com
That's not possible from WATIR. Its in the control of the driver.

--
--
Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
In short: search before you ask, be nice.
 
watir-...@googlegroups.com
http://groups.google.com/group/watir-general
watir-genera...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-genera...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

NaviHan

unread,
Apr 10, 2019, 10:12:10 AM4/10/19
to Watir General
Try this after you open the browser
browser.window.move_to(-3000, 0)

This will minimize the window

rajagopalan madasami

unread,
Apr 10, 2019, 10:13:41 AM4/10/19
to watir-...@googlegroups.com
But it will still shows up for some seconds.

--

Titus Fortner

unread,
Apr 10, 2019, 12:20:37 PM4/10/19
to Watir General
You can set it up to move off the screen when it opens by passing in the args to the ChromeOptions class: https://peter.sh/experiments/chromium-command-line-switches/#window-position

it probably will still steal focus momentarily even if it isn't on top of your screen,



On Wednesday, April 10, 2019 at 9:13:41 AM UTC-5, rajagopalan madasami wrote:
But it will still shows up for some seconds.

On Wed, 10 Apr, 2019, 7:42 PM NaviHan, <hishin...@gmail.com> wrote:
Try this after you open the browser
browser.window.move_to(-3000, 0)

This will minimize the window

On Wednesday, 10 April 2019 22:42:13 UTC+10, watirQ wrote:
Experts 

Each time when use .goto or open a new tab, the browser window will lump to the frontend of the screen. How to keep the Watir browser run on the backend, so that will  not interrupt other works

Thanks

--
--
Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
In short: search before you ask, be nice.
 
watir-...@googlegroups.com
http://groups.google.com/group/watir-general

---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-...@googlegroups.com.

rajagopalan madasami

unread,
Apr 10, 2019, 12:22:21 PM4/10/19
to watir-...@googlegroups.com
It would still bring the screen to the front when alert appears.


---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-genera...@googlegroups.com.

NaviHan

unread,
Apr 10, 2019, 12:33:41 PM4/10/19
to Watir General
Tried this, browser didnt minimize

  args = ['--allow-running-insecure-content --window-position=-3000, 0']
  browser
= Watir::Browser.new :chrome, options: {args: args}

Titus is this correct?

On Wednesday, 10 April 2019 22:42:13 UTC+10, watirQ wrote:

Titus Fortner

unread,
Apr 10, 2019, 2:46:58 PM4/10/19
to watir-general
I think it needs to be two strings separated by a comma. I have no idea if it actually works.

--

Justin Ko

unread,
Apr 10, 2019, 4:22:00 PM4/10/19
to Watir General
The --window-position arguments should be without a space - eg:

args = ['--window-position=-3000,0']

browser
= Watir::Browser.new :chrome, options: {args: args}

Note that this is just positioning it off-screen; not actually minimizing.

Justin

NaviHan

unread,
Apr 10, 2019, 9:27:21 PM4/10/19
to Watir General
  args = ['--window-position=-3000,0']
  browser = Watir::Browser.new :chrome, options: {args: args}

Doesnt work either.

Can the OP confirm if it works for him?


On Wednesday, 10 April 2019 22:42:13 UTC+10, watirQ wrote:

watirQ

unread,
Apr 13, 2019, 8:52:14 AM4/13/19
to Watir General
No. This works as the very beginning,  but the browser sill jumps into the front of the screen as soon as it's loading.. 

在 2019年4月11日星期四 UTC+8上午9:27:21,NaviHan写道:
Reply all
Reply to author
Forward
0 new messages