I have following code to download something (in this example it's a video). from playwright.sync_api import sync_playwright import func import os, time, shutil import requests from tqdm.auto import tqdm def download(): with page.expect_download() as download_info: page.click("text=720p (MP4") download = download_info.value with requests.get(download.url, stream=True) as r: # check header to get content length, in bytes total_length = int(r.headers.get("Content-Length")) # implement progress bar via tqdm with tqdm.wrapattr(r.raw, "read", total=total_length, desc="") as raw: # save the output to a file with open(f"{os.path.basename(r.url)}", 'wb') as output: shutil.copyfileobj(raw, output) download.save_as(os.path.join(func.report_folder_path, download.suggested_filename)) # initialize navigation with sync_playwright() as p: browser = p.chromium.launch(channel="msedge", headless=False) context = browser.new_context(accept_downloads=True) page = context.new_page() # go to canon s21 login print("Entering on download page") page.goto('https://www.jw.org/en/library/videos/#en/mediaitems/StudioFeatured/docid-702023003_1_VIDEO') page.wait_for_selector("text=Download") page.locator("text=Download").first.click() download() time.sleep(3) print('end') I'm trying to implement a file download progress bar at the same time as the download is done by playwright. This code manages to download the file in the directory correctly and although it does not show a timeout error, it only ends the download function after the 30 seconds of the default timeout. Another thing I noticed is that the download progress bar does not correctly show the real download status, i.e. it shows the download at 100% even though the real download file is still in progress. Any idea how to fix these problems? Continue reading...