webfp / tor-browser-selenium

Tor Browser automation with Selenium.
MIT License
556 stars 99 forks source link

Can't setup TBB paths on macOS #81

Closed Zorgatone closed 6 years ago

Zorgatone commented 7 years ago

I'm using these parameters for TorBrowserDriver():

tbb_fx_binary_path='/Applications/TorBrowser.app/Contents/MacOS/firefox',
tbb_profile_path='/Users/tommaso/Library/Application Support/TorBrowser-Data/Browser/52e8j7wk.default',
tor_cfg=cm.USE_RUNNING_TOR,
socks_port=7000,
control_port=cm.STEM_CONTROL_PORT

I get the following error:

Traceback (most recent call last):

  File "/Users/tommaso/repos/anon_visits/anon_visits.py", line 6, in <module>
    main()
  File "/Users/tommaso/repos/anon_visits/com/reloadcom/anonvisits/main.py", line 20, in main
    raise exc
  File "/Users/tommaso/repos/anon_visits/com/reloadcom/anonvisits/main.py", line 14, in main
    browser = TorBrowser()
  File "/Users/tommaso/repos/anon_visits/com/reloadcom/anonvisits/tor_browser.py", line 19, in __init__
    control_port=cm.STEM_CONTROL_PORT
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tbselenium/tbdriver.py", line 44, in __init__
    tbb_profile_path, tor_data_dir)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tbselenium/tbdriver.py", line 139, in setup_tbb_paths
    chdir(self.tbb_browser_dir)
FileNotFoundError: [Errno 2] No such file or directory: 'Browser'

I thought the first parameter (tbb_path) was optional, but then you join() it with 'Browser' and try to change the directory inside it (chdir()) which is raising the error because it tries to cd into './Browser/' I think.

How can I fix this, and start TBB on macOS? I'm not too sure what each path parameter shoud be

Zorgatone commented 7 years ago

@gunesacar could you take a look at this? :)

gunesacar commented 7 years ago

Thanks for reporting!

It seems our code has many Linux specific assumptions that don't hold for MacOS. As I understand, the TBB binaries and the application data are stored in separate places in MacOS - quite different than Linux TBB.

I'm sorry to say that this may take a while to fix. Not only because I don't have access to a Mac at the moment, but also I'm quite busy in the following two weeks.

After that, I'll be happy to help.

Zorgatone commented 7 years ago

@gunesacar thanks. I was just trying to change the defaults in 'common' but then I switched the development on another OS. I was trying on windows, but I'm going to try on linux just to be on the safe side

Thanks for the quick response :) Let me know if you need some help, I'll try to spare some time if you need

jnsprnw commented 6 years ago

Any updates on this?

gunesacar commented 6 years ago

Thanks for checking. The problem is that I don't have a Mac OS device and even if I fix this path issue, I don't see how I can maintain the support without being able to test and debug things locally.

So, I'm inclined to close the issue, and ask you to consider using a Linux container or VM to run the library.

Sorry about that.