
import os
import site
import sys
sys.path.append(os.path.join(os.getcwd(), 'tor-browser-selenium'))
# site.addsitedir(path.join(getcwd(), 'tor-browser-selenium'))
from tbselenium.tbdriver import TorBrowserDriver

with TorBrowserDriver('~/.tb-stable/tor-browser_en-US/') as driver:
    driver.get('https://check.torproject.org')
    sleep(1)  # stay one second in the page


import os
import site
site.addsitedir(os.path.join(os.getcwd(), 'tor-browser-selenium'))
from tbselenium.tbdriver import TorBrowserDriver

home_dir = os.path.expanduser('~')
tbb_path = os.path.join(home_dir, 'tbb', 'tor-browser_en-US')
tbb_fx_path = os.path.join(tbb_path, 'Browser', 'firefox')
tbb_profile_path = os.path.join(tbb_path, 'Browser', 'TorBrowser', 'Data',
                                'Browser')
logfile_path = os.path.join(home_dir, 'FingerprintSecureDrop', 'logging',
                            'firefox.log')

with TorBrowserDriver(tbb_path=tbb_path,
                      tbb_logfile_path=logfile_path) as driver:
    driver.get('https://check.torproject.org')
    time.sleep(1)  # stay one second in the page

Fix test to work with patched tbdriver.py (see NOTICE in diff)
Fix test to work with patched tbdriver.py (see NOTICE in diff)

  
  import os
  import site
- import sys
- sys.path.append(os.path.join(os.getcwd(), 'tor-browser-selenium'))
- # site.addsitedir(path.join(getcwd(), 'tor-browser-selenium'))
+ site.addsitedir(os.path.join(os.getcwd(), 'tor-browser-selenium'))
  from tbselenium.tbdriver import TorBrowserDriver
  
- with TorBrowserDriver('~/.tb-stable/tor-browser_en-US/') as driver:
+ home_dir = os.path.expanduser('~')
+ tbb_path = os.path.join(home_dir, 'tbb', 'tor-browser_en-US')
+ tbb_fx_path = os.path.join(tbb_path, 'Browser', 'firefox')
+ tbb_profile_path = os.path.join(tbb_path, 'Browser', 'TorBrowser', 'Data',
+                                 'Browser')
+ logfile_path = os.path.join(home_dir, 'FingerprintSecureDrop', 'logging',
+                             'firefox.log')
+ 
+ with TorBrowserDriver(tbb_path=tbb_path,
+                       tbb_logfile_path=logfile_path) as driver:
      driver.get('https://check.torproject.org')
-     sleep(1)  # stay one second in the page
+     time.sleep(1)  # stay one second in the page
  
Fix test to work with patched tbdriver.py (see NOTICE in diff)
## Code Before:

import os
import site
import sys
sys.path.append(os.path.join(os.getcwd(), 'tor-browser-selenium'))
# site.addsitedir(path.join(getcwd(), 'tor-browser-selenium'))
from tbselenium.tbdriver import TorBrowserDriver

with TorBrowserDriver('~/.tb-stable/tor-browser_en-US/') as driver:
    driver.get('https://check.torproject.org')
    sleep(1)  # stay one second in the page

## Instruction:
Fix test to work with patched tbdriver.py (see NOTICE in diff)
## Code After:

import os
import site
site.addsitedir(os.path.join(os.getcwd(), 'tor-browser-selenium'))
from tbselenium.tbdriver import TorBrowserDriver

home_dir = os.path.expanduser('~')
tbb_path = os.path.join(home_dir, 'tbb', 'tor-browser_en-US')
tbb_fx_path = os.path.join(tbb_path, 'Browser', 'firefox')
tbb_profile_path = os.path.join(tbb_path, 'Browser', 'TorBrowser', 'Data',
                                'Browser')
logfile_path = os.path.join(home_dir, 'FingerprintSecureDrop', 'logging',
                            'firefox.log')

with TorBrowserDriver(tbb_path=tbb_path,
                      tbb_logfile_path=logfile_path) as driver:
    driver.get('https://check.torproject.org')
    time.sleep(1)  # stay one second in the page
