How to use it on Windows Chrome
See original GitHub issueFirst to thank you for this great tool. It’s Awesome!!
I managed to use it on Windows-Chrome.
That’s are the changes i’ve done.
Change SIGPIPE
On windows there’s no SIGPIPE signal. I’ve seen on the python docs that they advise to catch the exception BrokenPipeError:
From https://docs.python.org/3.7/library/signal.html#note-on-sigpipe
Changes on main function of brotab_mediator.py def main(): #signal.signal(signal.SIGPIPE, signal_pipe) monkeypatch_socket_bind() disable_click_echo()
global actual_port
for port in range(DEFAULT_MIN_HTTP_PORT, DEFAULT_MAX_HTTP_PORT):
logger.info('Starting mediator on %s:%s...',
DEFAULT_HTTP_IFACE, port)
actual_port = port
try:
app.run(DEFAULT_HTTP_IFACE, port, debug=False, threaded=False)
logger.info('Exiting mediator...')
break
except OSError as e:
logger.info('Cannot bind on port %s: %s', port, e)
except BrokenPipeError:
signal_pipe
else:
logger.error(
'No TCP ports available for bind in range from %s to %s',
DEFAULT_MIN_HTTP_PORT, DEFAULT_MAX_HTTP_PORT)
I think this way is compatible with all OS.
How to Configure for Chrome on Windows
A) Changes on brotab_mediator.json: Path entry must have double \
Example:
"path": "D:\\Python-3.7.6.0\\Envs\\BroTab\\Scripts\\bt_mediator.EXE",
B) Create a Registry Key
From https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-location
On Windows, the manifest file can be located anywhere in the file system. The application installer must create registry key HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.my_company.my_application or HKEY_CURRENT_USER\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.my_company.my_application, and set default value of that key to the full path to the manifest file. For example, using the following command: REG ADD “HKCU\Software\Google\Chrome\NativeMessagingHosts\com.my_company.my_application” /ve /t REG_SZ /d “C:\path\to\nmh-manifest.json” /for using the following .reg file: Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Google\Chrome\NativeMessagingHosts\com.my_company.my_application] @=“C:\path\to\nmh-manifest.json”
In this case i’ve used : Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\brotab_mediator] @=“[PathWhereManifestFileIs]\brotab_mediator.json”
Enable Logging on Chrome
Just a quick note if you want to see what’s happenning on Chrome side…
From https://www.chromium.org/for-testers/enable-logging
To enable logging, launch Chrome with these command line flags:
–enable-logging=stderr --v=1 # Linux (newer instructions for Linux: here) –enable-logging --v=1 # Windows –enable-logging=stderr --v=1 > log.txt 2>&1 # Windows, seems to capture more output
Hope to get time to make it work on FF.
Edit : I cannot get any response from query command, in any of its variations. Always returns b’[]’
2020-02-12 17:40:00,818 19656 INFO getting browser name
2020-02-12 17:40:00,818 19656 INFO SENDING: {'name': 'get_browser'}
2020-02-12 17:40:00,819 19656 INFO RECEIVED: b'"chrome/chromium"'
2020-02-12 17:40:03,751 19656 INFO query info: eyJ1cmwiOiBbIio6Ly8qLmdvb2dsZS5jb20vKiJdfQ==
2020-02-12 17:40:03,752 19656 INFO SENDING: {'name': 'query_tabs', 'query_info': 'eyJ1cmwiOiBbIio6Ly8qLmdvb2dsZS5jb20vKiJdfQ=='}
2020-02-12 17:40:03,755 19656 INFO RECEIVED: b'[]'
2020-02-12 17:42:04,148 19656 INFO getting browser name
2020-02-12 17:42:04,149 19656 INFO SENDING: {'name': 'get_browser'}
2020-02-12 17:42:04,150 19656 INFO RECEIVED: b'"chrome/chromium"'
2020-02-12 17:42:07,076 19656 INFO query info: eyJ1cmwiOiBbIioiXX0=
2020-02-12 17:42:07,076 19656 INFO SENDING: {'name': 'query_tabs', 'query_info': 'eyJ1cmwiOiBbIioiXX0='}
2020-02-12 17:42:07,077 19656 INFO RECEIVED: b'[]'
2020-02-12 17:42:50,217 19656 INFO getting browser name
2020-02-12 17:42:50,217 19656 INFO SENDING: {'name': 'get_browser'}
2020-02-12 17:42:50,218 19656 INFO RECEIVED: b'"chrome/chromium"'
2020-02-12 17:43:51,644 19656 INFO getting browser name
2020-02-12 17:43:51,645 19656 INFO SENDING: {'name': 'get_browser'}
2020-02-12 17:43:51,647 19656 INFO RECEIVED: b'"chrome/chromium"'
2020-02-12 17:43:54,571 19656 INFO query info: eyJ0aXRsZSI6ICIqIn0=
2020-02-12 17:43:54,572 19656 INFO SENDING: {'name': 'query_tabs', 'query_info': 'eyJ0aXRsZSI6ICIqIn0='}
2020-02-12 17:43:54,575 19656 INFO RECEIVED: b'[]'
Any clue?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)

Top Related StackOverflow Question
Thanks for the great and detailed write up! Your suggestions definitely need to be merged when I have a bit more time.
That was and is a huge pain point for me. It was so inconvenient to check extension’s logs in a browser given that I work mostly in command-line. I’ll try that and I wish there were simple and reliable way to do the same in Firefox.
Added all your changes from the pull request and also implemented these two. Now Windows support should be much better.