Closed ghost closed 1 year ago
Thanks for the suggestion @regnveig. Let me know how the following looks like: https://github.com/webfp/tor-browser-selenium/compare/custom_geckodriver_port?expand=1
The choice of default 0
is based on:
https://github.com/SeleniumHQ/selenium/blob/40c16bb016f979a5ba327f75c8c0f60138f2fbbe/py/selenium/webdriver/firefox/service.py#L38-L40
@gunesacar, thank you! It looks much better than the fix I used. I guess it's pretty good to merge!
I've merged these changes into main and made a release on PyPI. Thanks for the suggestion, @regnveig.
By default tbselenium creates
selenium.webdriver.firefox.service.Service
without specifyingport
, which makes the Service object connect gecko to a random free port on localhost. It is a problem in Tails, where all localhost ports, except Tor ports (9001, etc.), are closed by default. There is a possibility to accept connection to a particular port viaiptables
, but it becomes tricky if the port is always random.I suggest the following:
TorBrowserDriver.__init__()
arguments:https://github.com/webfp/tor-browser-selenium/blob/98c2bd5bdf1c83bd2c54cb0ba936b1b35647315c/tbselenium/tbdriver.py#L27
https://github.com/webfp/tor-browser-selenium/blob/98c2bd5bdf1c83bd2c54cb0ba936b1b35647315c/tbselenium/tbdriver.py#L79
https://github.com/webfp/tor-browser-selenium/blob/98c2bd5bdf1c83bd2c54cb0ba936b1b35647315c/tbselenium/tbdriver.py#L85