Skip to content

Commit 915f7a1

Browse files
MadsHangaardMads Hangaardstephanlensky
authored
Fix dlexpect (#185)
* Added download_path to DownloadExpectation * Added change to CHANGELOG.md --------- Co-authored-by: Mads Hangaard <[email protected]> Co-authored-by: Stephan Lensky <[email protected]>
1 parent d25fa47 commit 915f7a1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- Fix for calls to `evaluate` that return JSON: only set `serialization_options` when `return_by_value=False` @thromer
13+
- Fix download_path error in `DownloadExpectation` (https://github.com/cdpdriver/zendriver/issues/184) @MadsHangaard
1314

1415
### Added
1516

zendriver/core/expect.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ def __init__(self, tab: Connection):
202202
self.default_behavior = (
203203
self.tab._download_behavior[0] if self.tab._download_behavior else "default"
204204
)
205+
self.download_path = (
206+
self.tab._download_behavior[1]
207+
if self.tab._download_behavior and len(self.tab._download_behavior) > 1
208+
else None
209+
)
205210

206211
async def _handler(self, event: cdp.browser.DownloadWillBegin) -> None:
207212
self._remove_handler()
@@ -225,7 +230,9 @@ async def __aexit__(self, *args: Any) -> None:
225230
Exit the context manager, removing handler, set download behavior to default.
226231
"""
227232
await self.tab.send(
228-
cdp.browser.set_download_behavior(behavior=self.default_behavior)
233+
cdp.browser.set_download_behavior(
234+
behavior=self.default_behavior, download_path=self.download_path
235+
)
229236
)
230237
self._remove_handler()
231238

0 commit comments

Comments
 (0)