Enumerate how many tabs are open for a given executable (chrome.exe, firefox.exe). Discerns between different distributions of browsers using the same executable name (Google Chrome and Chromium).
Counts open tabs for msedge.exe, firefox.exe, chrome.exe (including Chromium and Google Chrome). Breakdown of where tabs come from if multiple chrome.exe distributions. Relies on pywinauto UI automation so it doesn't need browser-specific extensions or APIs. Includes process verification to ensure it's targeting the correct application and no impostor processes that have the same name.
I add a UI that tracks live with polling rate of 10 seconds or whatever the user wants.
- Python 3.x
- Windows Operating System
- Required Python packages:
pywinautoandpsutil.
Install the necessary packages using pip:
pip install pywinauto psutiltabber.py
- Save the file.
- Open the file in a text editor.
- Navigate to the
if __name__ == "__main__":block at the bottom of the script. - Uncomment the line for the browser you wish to inspect. To count chrome.exe tabs:
if __name__ == "__main__": # Uncomment the browser you want to count. browser = 'chrome.exe' # browser = 'firefox.exe' # browser = 'msedge.exe' result = count_browser_tabs(browser) # ...
- Run the script from your terminal focused on the directory containing the file:
python tabber.py
omnitabber.py
- Save the file.
- Open the file in a text editor.
- Check if
browsers_to_checkhas all the executables you want to check. - Run the script from your terminal focused on the directory containing the file:
python omnitabber.py
The script will print the total number of tabs found.
- For Firefox or Edge you will get a single integer count:
Found 1 windows for msedge.exe. Open tabs in msedge.exe: 8 - For
chrome.exe, you will get a total count and a detailed breakdown by brand:Found 2 windows for chrome.exe. Total open tabs across all Chromium distributions: 12 --- Breakdown by Brand --- - Google Chrome: 9 tabs - Chromium: 3 tabs
omnitabber.py will do every executable in a batch operation, and the output is much the same.
My friends kept asking how many tabs I have open. I got tired of counting.
Windows Only: This script relies on Windows-specific UI automation libraries and will not work on macOS or Linux. UI Dependent: Since it reads the live UI structure, significant updates to a browser's user interface could potentially break the script's ability to find the tab elements correctly. I will try to update if easy.