Skip to content

download File #528

@osmenia

Description

@osmenia

Hi Team,

I need help,
Download works but 10 times is same (first) file downloaded.

what i am doing wrang in code?

tnx

here is code:

`from playwright.sync_api import sync_playwright
import base64
import sys
import time

def run(playwright):
browser = playwright.chromium.launch(headless=False)
context = browser.new_context(accept_downloads=True)
df3 = pd.DataFrame()

# Open new page
page = context.new_page()

page.goto(
    "https://file-examples.com/index.php/sample-documents-download/sample-xls-download/")

cookies = context.cookies()
# print("Coockies", cookies)

handles = page.query_selector_all("#table-files .file-link")

for x in handles:
    with page.expect_download() as download_info:
        page.click("a.btn")

    download = download_info.value
    print(download)
    path = download.path()
    print(path)

page.close()

---------------------

context.close()
browser.close()

with sync_playwright() as playwright:
run(playwright)
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions