[BUG] page.screenshot failed on Android devices (flaky screenshots)
See original GitHub issueContext:
- Playwright Version: 1.23.0 (but this behavior started a long time ago)
- Operating System: Linux and Mac
- Node.js version: 16.15.1
- Browser: Chromium (WebView on android devices)
- Extra: Samsung Galaxy A50 (Android 11), Google Pixel 5 (Android 12)
PW API debug log:
pw:api => page.evaluate started +1ms
pw:api <= page.evaluate succeeded +146ms
pw:api => page.screenshot started +0ms
pw:api taking page screenshot +1ms
pw:api <= page.screenshot failed +5s
pw:api => page.evaluate started +3ms
pw:api <= page.evaluate succeeded +77ms
pw:api => page.screenshot started +0ms
pw:api taking page screenshot +1s
pw:api <= page.screenshot succeeded +2s
Full log in attachment logs.txt
Describe the bug In the test on a real device:
- Open the webview in the application
- Take a screenshot using
page.screenshot
The problem is that sometimes for some reason the screenshot is not taken, after a few attempts I came up with the idea of immediately repeating the screenshot in such a situation, and it worked. But sometimes I need to repeat the screenshot call several times. Increasing the waiting time for the screenshot does not help (I tried to wait up to 5 minutes)
I understand that working with devices is an experimental feature, but maybe it is possible to add more information to the debug tool to understand what is the reason for such unstable behavior of screenshots?
Thanks for your attention:)
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
8 Best Fixes for Screenshot Not Working on Android - TechWiser
1. Clear All Open Apps ... Begin the troubleshooting process by closing all open apps on your Android phone. To do so, open...
Read more >How to solve screenshot errors on devices with Android 12 OS
To do this, follow these steps: 1 Open your “Settings” menu and tap on “Apps” option. 2 At the upper right corner of...
Read more >Android Screenshot Not Working? Try These Fixes - Lifewire
Another cause is Chrome Incognito Mode, which doesn't allow screenshots. The problem could also be due to a mechanical issue, such as a...
Read more >Emulator release notes - Android Developers
Added support for snapshot debugging on test failure. virtio-gpu: updated ... Fixed a flaky bug with Wi-Fi not connected when the emulator starts....
Read more >Using Selenium Webdriver for Full Page Screenshots
One of the most performed actions of any webpage tester is taking a screenshot of the webpage. Whenever a tester finds and reports...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I looked at the logs.
Page.captureScreenshot
CDP command is taking more than 5 seconds. Maybe it is hanging, or maybe it’s just slow - we don’t know unfortunately.Fixing this issue requires debugging chromium on android, with a local repro that includes this specific webview app. This is a lot of setup, so I don’t think we’ll be prioritizing this issue high enough in the nearest future.
For now, I’d suggest to use
waitForTimeout()
workaround if that makes things work reliably.Let’s make sure non-stalling evaluate is not stalling and allow an explicit nowait option that disables caret waiting.