Skip to content

Commit

Permalink
Make sure session is maintained during download
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwang committed Sep 29, 2024
1 parent 8a932f1 commit 558e2b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion page_perf_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ def download_dummy_file(self):
open_download_link.click()
with SeleniumCustomWait(self.driver, 1200):
download_link = self.driver.find_element(By.XPATH, "//div[@data-index='0']//div[@data-state='ok' and contains(., 'Selenium_test_1_Input_data')]//a[@title='Download']")
r = requests.get(download_link.get_attribute("href"), stream=True)
all_cookies=self.driver.get_cookies()
cookies_dict = {cookie["name"]: cookie["value"] for cookie in all_cookies}
r = requests.get(download_link.get_attribute("href"), stream=True, cookies=cookies_dict)
sig = hashlib.md5()
for line in r.iter_lines():
sig.update(line)
Expand Down

0 comments on commit 558e2b0

Please sign in to comment.