11import shutil
2- from os import environ , chdir
2+ from os import environ
33import os
44from os .path import isdir , isfile , join , abspath , dirname
55from time import sleep
@@ -48,7 +48,6 @@ def __init__(self,
4848 tbb_profile_path = "" ,
4949 tbb_logfile_path = "" ,
5050 tor_data_dir = "" ,
51- workdir = "" ,
5251 executable_path = GECKO_DRIVER_EXE_PATH ,
5352 pref_dict = {},
5453 socks_port = None ,
@@ -74,7 +73,7 @@ def __init__(self,
7473 self .remove_on_exit = []
7574
7675 self .setup_tbb_paths (tbb_browser_dir , tbb_path , tbb_fx_binary_path ,
77- tbb_profile_path , tor_data_dir , workdir )
76+ tbb_profile_path , tor_data_dir )
7877 self .options = Options () if options is None else options
7978 install_noscript = False
8079
@@ -175,7 +174,7 @@ def init_ports(self, tor_cfg, socks_port, control_port):
175174 self .control_port = control_port
176175
177176 def setup_tbb_paths (self , tbb_browser_dir , tbb_path , tbb_fx_binary_path ,
178- tbb_profile_path , tor_data_dir , workdir ):
177+ tbb_profile_path , tor_data_dir ):
179178 """Update instance variables based on the passed paths.
180179
181180 TorBrowserDriver can be initialized by passing either
@@ -253,24 +252,11 @@ def setup_tbb_paths(self, tbb_browser_dir, tbb_path, tbb_fx_binary_path,
253252 make_writeable_recursive (temp_tor_data_dir )
254253 tor_data_dir = temp_tor_data_dir
255254
256- # TB can't find bundled "fonts" if we don't switch to tbb_browser_dir
257- if not workdir :
258- workdir = self .tbb_browser_dir
259- if not isdir (workdir ):
260- raise TBDriverPathError ("Invalid workdir directory %s" % workdir )
261- # TODO check if workdir is writable
262- # or at least f"{workdir}/.cache" and
263- # f"{workdir}/.tor project" must be writable
264- # if they already exist
265-
266255 #self.tbb_path = abspath(tbb_path)
267256 self .tbb_browser_dir = abspath (tbb_browser_dir )
268257 self .tbb_profile_path = abspath (tbb_profile_path )
269258 self .tbb_fx_binary_path = abspath (tbb_fx_binary_path )
270259 self .tor_data_dir = abspath (tor_data_dir )
271- self .workdir = abspath (workdir )
272-
273- chdir (self .workdir )
274260
275261 def load_url (self , url , wait_on_page = 0 , wait_for_page_body = False ):
276262 """Load a URL and wait before returning.
0 commit comments