-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Closed
Copy link
Labels
Description
Version
1.53
Steps to reproduce
While using Playwright for Python to load a public PDF URL in a simulated mobile device (iPhone 13), the page does not render the PDF nor trigger any download behavior. DevTools shows the error:
"no enabled plugin supports this MIME type".
Expected behavior
Either:
- The PDF content should be displayed in the browser (as it would in desktop emulation), or
- A file download should be triggered, or
- At least page.expect_download() should capture the file download attempt.
Actual behavior
- The page appears blank.
- DevTools (Elements tab) shows: "no enabled plugin supports this MIME type".
- No PDF content is rendered.
- No download is triggered.
- page.expect_download() times out and does not capture any download event.
Additional context
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
iphone_13 = p.devices['iPhone 13']
browser = p.chromium.launch(headless=False)
context = browser.new_context(**iphone_13)
page = context.new_page()
pdf_url = "https://sharepointpubstor.blob.core.windows.net/policylibrary-prod/Enrolment%20Procedure.pdf"
# Option 1: Direct navigation
page.goto(pdf_url)
# Option 2: Attempt to capture download
# with page.expect_download() as download_info:
# page.goto(pdf_url)
# download = download_info.value
# download.save_as("enrolment_procedure.pdf")
# Option 3: Use third party PDF viewer
# viewer_url = f"https://mozilla.github.io/pdf.js/web/viewer.html?file={pdf_url}"
# page.goto(viewer_url)
page.pause()📌 Additional Notes
- This may be due to Chromium behavior when emulating mobile devices, but it would be helpful for Playwright to document or expose behavior differences for PDFs under emulation.
- At minimum, the expect_download() handler should still work if a download attempt is made.
Environment
- Playwright version: 1.53.0
- Python version: 3.11.x
- Browser: Chromium (default from Playwright)
- OS: macOS 12.7.5
- Device Emulation: playwright.devices['iPhone 13']
Reactions are currently unavailable