How to run Selenium with Firefox?

I am trying to write a script that uses Selenium (the Python bindings) with Firefox browser through geckodriver webdriver in Whonix Workstation.

It launches the browser but never loads a test URL.

After I interrupt the script with Ctrl-C, I get Python traceback looking like this:

selenium/webdriver/firefox/firefox_binary.py", line 73, in launch_browser
self._wait_until_connectable(timeout=timeout)

geckodriver logs lines like these:

geckodriver INFO Listening on 127.0.0.1:41181

the port number is picked randomly, since it’s always different.

This looks like a firewalling issue at loopback interface level, but I’m not sure about it. What do I need to do to make it work?

Listening port, firewall is probably not an issue.

Opening server ports on localhost in the workstation such as with a web server (in context of Onion Services - Whonix) is a common thing.

debugging:

What could get into the way is the stream isolation default configuration: