-
Notifications
You must be signed in to change notification settings - Fork 271
Description
Version
1.52.0
Steps to reproduce
This is the same issue as microsoft/playwright#36702, which was logged on the JavaScript Playwright library last year. However, at my work we are running into the same issue with the Java library, so I am re-logging the issue here. Essentially, the issue is that sometimes the Page.screenshot() method hangs forever regardless of the timeout set when taking the screenshot. This is a regression because it is not reproducible in version 1.37.0, which is the version we were originally using, but is reproducible in version 1.52.0, which we upgraded to last year to address a security issue. It is also reproducible in the latest version, 1.58.0.
You can clone this repo, which is based off of the repo mtsmfm provided in the JavaScript repo issue, to easily reproduce: https://github.com/zach-goldberg/playwright-screenshot-issue
- Clone the repo
- Run the main method in PlaywrightScreenshotIssue.java
- You will probably see the program hang indefinitely in trying to take a screenshot after "Taking screenshot 1" is printed to the console. The expected behavior is either that taking the screenshot succeeds or a TimeoutError is thrown after the timeout (set to 1 second).
This is a somewhat big issue for us, because we use Playwright not for automation testing but instead as part of our application. We have a "screenshot service" microservice that uses Playwright to take screenshots for a niche business use case and have run into this issue a few times in production.
The example repo provided is able to consistently reproduce the issue by causing the webpage to not respond. Obviously at work we are not forcing a webpage to not respond and I don't believe the webpage is not responding when this issue happens. In the times that we've seen this at work, it basically always succeeds on retry (i.e. creating a new Playwright instance and trying to do the exact same thing that ran into the issue).
Expected behavior
Either that taking a screenshot succeeds or a TimeoutError is thrown after the timeout (set to 1 second) in the linked repo.
Actual behavior
Calling page.screenshot() hangs indefinitely, regardless of the timeout set.
Additional context
No response
Environment
- Operating system: MacOS 15.7.3
- CPU: Apple M1 MAX
- Java version: OpenJDK 64-Bit Server VM Corretto-17.0.8.8.1