-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Java library poor playwright/java docker image integration #1268
Comments
As long as the image tag matches playwright version you use in the project, the image should already contain all 3 browsers downloaded (in A bit more on each of the items from the observed behavior section:
Playwright doesn't detect if node.js is installed on the system, instead it uses the one that is shipped in driver-bundle package. This is a deliberate decision. We can change this model in the future but it has served well so far. There is a related feature request: #1196. Also, you can manually specify alternative node.js location via PLAYWRIGHT_NODEJS_PATH or entire driver location via playwright.cli.dir. If you specify the latter playwright will not extract anything from the driver bundle.
Yes, this happens on every launch of playwright java. Unfortunately, Maven doesn't provide any means for extracting a bundled executable into a managed location.
As I mentioned above this is likely because of the version mismatch.
The browsers are downloaded into a cache directory managed by playwright rather than /tmp. See this page for more details. |
Closing per the response above, feel free to open a new issue if it doesn't work. |
Doesn't. I have dived into this more and these is problems the library has:
|
Anyway. Even manually crafting base image with such capabilities close to impossible, as there is no tooling to unpack driver to any location. I literally had to unzip it from jar and put binaries to docker fs. My approach will fail next time maven dependency is upgraded (it anyway will fail as the library already rely on a specific base image version via |
Tradeof will provide tooling for unpacking driver to specific location |
As the environment I work on explicitly disallows dynamically-created shell script execution. Sad to hear that Microsoft allows such. |
Preinstalling Node.js and driver in Docker images once makes total sense. We may even try to switch to the mode where we download Node.js and the driver to a local cache when starting Playwright the same way as we download browsers today. That has been a low priority task so far but we might find some resources to work on this. |
@msangel / @yury-s I have the similar requirement. Installing only required playwright packages in existing Docker image. I have an existing docker image of my Java based application. I want to open web page in headless browser mode in my existing java application using playwright java library. Can you please help me understand, how did you do this? Any sample code or DockerFile will be helpful ? |
Right now java library when running in the playwright/java docker image is not aware of installed browsers automatically. Also Even having a lot of things installed, the library requires node.js instalation that is not bundled with image(yes, it bundled with the library itself, but this have some drawbacks, see below).
Right now running java application with this library inside of playwright/java container with default settings behaves the same way as it would behave on empty+java base image. When the application started and playwright API is called, these steps happen:
Expected behavior:
The text was updated successfully, but these errors were encountered: