2
2
import threading
3
3
import zipfile
4
4
from seleniumbase .fixtures import constants
5
- from seleniumbase import drivers
6
5
7
- DRIVER_DIR = os .path .dirname (os .path .realpath (drivers .__file__ ))
8
- PROXY_ZIP_PATH = "%s/%s" % (DRIVER_DIR , "proxy.zip" )
9
6
DOWNLOADS_DIR = constants .Files .DOWNLOADS_FOLDER
10
- PROXY_ZIP_PATH_2 = "%s/%s" % (DOWNLOADS_DIR , "proxy.zip" )
7
+ PROXY_ZIP_PATH = "%s/%s" % (DOWNLOADS_DIR , "proxy.zip" )
11
8
PROXY_ZIP_LOCK = "%s/%s" % (DOWNLOADS_DIR , "proxy.lock" )
12
9
13
10
@@ -70,15 +67,11 @@ def create_proxy_zip(proxy_string, proxy_user, proxy_pass):
70
67
)
71
68
lock = threading .RLock () # Support multi-threaded test runs with Pytest
72
69
with lock :
73
- try :
74
- zf = zipfile .ZipFile (PROXY_ZIP_PATH , mode = "w" )
75
- except IOError :
76
- # Handle "Permission denied" on the default proxy.zip path
77
- abs_path = os .path .abspath ("." )
78
- downloads_path = os .path .join (abs_path , DOWNLOADS_DIR )
79
- if not os .path .exists (downloads_path ):
80
- os .mkdir (downloads_path )
81
- zf = zipfile .ZipFile (PROXY_ZIP_PATH_2 , mode = "w" )
70
+ abs_path = os .path .abspath ("." )
71
+ downloads_path = os .path .join (abs_path , DOWNLOADS_DIR )
72
+ if not os .path .exists (downloads_path ):
73
+ os .mkdir (downloads_path )
74
+ zf = zipfile .ZipFile (PROXY_ZIP_PATH , mode = "w" )
82
75
zf .writestr ("background.js" , background_js )
83
76
zf .writestr ("manifest.json" , manifest_json )
84
77
zf .close ()
@@ -92,8 +85,6 @@ def remove_proxy_zip_if_present():
92
85
try :
93
86
if os .path .exists (PROXY_ZIP_PATH ):
94
87
os .remove (PROXY_ZIP_PATH )
95
- elif os .path .exists (PROXY_ZIP_PATH_2 ):
96
- os .remove (PROXY_ZIP_PATH_2 )
97
88
if os .path .exists (PROXY_ZIP_LOCK ):
98
89
os .remove (PROXY_ZIP_LOCK )
99
90
except Exception :
0 commit comments