Skip to content

Commit 6a7152a

Browse files
committed
FIX: Update Undetected Chrome check for download finished.
1 parent acefc09 commit 6a7152a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

botcity/web/browsers/undetected_chrome.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,11 @@ def wait_for_downloads(driver):
138138
"""
139139
if not driver.current_url.startswith("chrome://downloads"):
140140
driver.get("chrome://downloads/")
141+
# Chrome changed the `e.state` from a ENUM Str to numbers. Here 2 means COMPLETE.
142+
# Reference: https://shorturl.at/G4EES
141143
return driver.execute_script("""
142144
var items = document.querySelector('downloads-manager')
143145
.shadowRoot.getElementById('downloadsList').items;
144-
if (items.every(e => e.state === "COMPLETE"))
146+
if (items.every(e => e.state === 2))
145147
return items.map(e => e.fileUrl || e.file_url);
146148
""")

0 commit comments

Comments
 (0)