Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.15.z] Fix get_downloads_list which is causing save_downloaded_file to fail #1100

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions airgun/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from datetime import datetime
import logging
import os
import time
import urllib
from urllib.parse import unquote

Expand Down Expand Up @@ -344,19 +343,12 @@ def get_downloads_list(self):
downloads_uri = 'chrome://downloads'
if not self.url.startswith(downloads_uri):
self.url = downloads_uri
time.sleep(3)
script = (
'return downloads.Manager.get().items_'
'.filter(e => e.state === "COMPLETE")'
'.map(e => e.file_url || e.fileUrl);'
'return document.querySelector("downloads-manager")'
'.shadowRoot.querySelector("#downloadsList")'
'.items.filter(e => e.state == "2")'
'.map(e => e.filePath || e.file_path || e.fileUrl || e.file_url);'
)
if self.browser_type == 'chrome':
script = (
'return document.querySelector("downloads-manager")'
'.shadowRoot.querySelector("#downloadsList")'
'.items.filter(e => e.state === "COMPLETE")'
'.map(e => e.filePath || e.file_path || e.fileUrl || e.file_url);'
)
return self.execute_script(script)

def get_file_content(self, uri):
Expand Down
Loading