Skip to content

Commit 18cd122

Browse files
committed
[py] fix bug where downloaded file was not getting unzipped
1 parent 7680b7c commit 18cd122

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

py/selenium/webdriver/remote/webdriver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import types
2424
import typing
2525
import warnings
26+
import zipfile
2627
from abc import ABCMeta
2728
from base64 import b64decode
2829
from base64 import urlsafe_b64encode
@@ -1162,6 +1163,10 @@ def download_file(self, file_name: str, target_directory: str) -> None:
11621163
with open(target_file, "wb") as file:
11631164
file.write(base64.b64decode(contents))
11641165

1166+
with zipfile.ZipFile(target_file, "r") as zip_ref:
1167+
zip_ref.extractall(target_directory)
1168+
1169+
11651170
def delete_downloadable_files(self) -> None:
11661171
"""Deletes all downloadable files."""
11671172
if "se:downloadsEnabled" not in self.capabilities:

0 commit comments

Comments
 (0)