1

I'm using the selenium webdriver to run automated tests in firefox on my web applications, and while it's all working perfectly, it's a little bit annoying how firefox pops up over everything while it's running.

Is there a way I can always always always by default hide firefox? Or minimize it every single time it opens or something?

What I'd really like is for it to always open in a default workspace. I'm using Ubuntu Tweak so I have 16 x 16 workspaces. Can I get firefox to always open in a certain one?

2 Answers 2

1

The following script lets you select a window , and will keep that window minimized while the script is running. It supports only one windows, so if you open new window of application - that window won't be affected.

You can run it easily like so:

python keep_minimized.py

When the script starts, mouse cursor will turn into a cross. Select the window you want to keep minimized. Now every time that window gains focus (be it via launcher click or Atl+Tab), it will be minimized.

You can obtain the script from here or from github gist

from gi.repository import GdkX11,Gdk
import subprocess
import time

def run_sh(cmd):
    # run shell commands
    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
    out = p.stdout.read().strip()
    return out 

def get_window_xid():
    for item in run_sh("xwininfo -int").split("\n"):
        if "Window id" in item:
           return item.split()[3]

user_selection = get_window_xid()
screen =  Gdk.Screen.get_default()
while True :
    time.sleep(0.25)
    active_window = screen.get_active_window()
    if int(active_window.get_xid()) == int(user_selection):
        active_window.iconify()
0

I had the same problem today

Solution:

  1. sudo apt-get install compizconfig-settings-manager (if CCSM not already installed)
  2. Go to the dash and start compizconfig
  3. Click on "Window Management" in the left-side pane
  4. Activate the applications switcher

When CCSM ask you to deactivate the former switcher shortcut, just agree.

Now you can run a selenium server switch than to another window with: Super+S

1
  • Schlumfi: please review my edits and apply the same kind of system in the future (always assume very little knowledge, structure the answer) ;-)
    – Fabby
    Dec 18, 2014 at 2:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .