Reputation: 1198
Recently came across this tool Puppeteer, checked documentation and few videos related to the options it is providing. It matches my use case of executing UI tests in headless browser without the installing the browser.
With puppeteer we need not to install chrome browser to run tests is my understanding please correct me if I'm wrong.
I need to run UI tests using the Java programming language but puppeteer is a node library.
Can anyone tell me how to do this or if this is even possible?
Upvotes: 7
Views: 20683
Reputation: 425
Stumbled upon this now (1 year after the original post).
You can easily run your pptr script from java like this
Runtime.getRuntime().exec(node pptr_script_file.js);
Additionally, you can provide parameters to your JS script separating them with spaces. Example: node pptr_script_file.js param1 param2 param3
Upvotes: 4
Reputation: 99
No this is not possible to easily use Puppeteer from Java But fortunately, Puppeteers' successor named Playwright ( https://playwright.dev/ ) has a version for Java ( https://github.com/microsoft/playwright-java ) now! At the moment, Playwright for Java a pretty stable beta, being developed and you can always ask for support in Slack Comparing these two tools, Playwright is pretty similar to Puppeteer in terms of syntax but supports 3 main browsers (Chromiun, Firefox and WebKit) out of the box
Upvotes: 9