Skip to content

Commit

Permalink
[py] fix bug where downloaded file was not getting unzipped
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Nov 3, 2023
1 parent 7680b7c commit 18cd122
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions py/selenium/webdriver/remote/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import types
import typing
import warnings
import zipfile
from abc import ABCMeta
from base64 import b64decode
from base64 import urlsafe_b64encode
Expand Down Expand Up @@ -1162,6 +1163,10 @@ def download_file(self, file_name: str, target_directory: str) -> None:
with open(target_file, "wb") as file:
file.write(base64.b64decode(contents))

with zipfile.ZipFile(target_file, "r") as zip_ref:
zip_ref.extractall(target_directory)


def delete_downloadable_files(self) -> None:
"""Deletes all downloadable files."""
if "se:downloadsEnabled" not in self.capabilities:
Expand Down

0 comments on commit 18cd122

Please sign in to comment.