Rayrun
← Back to Discord Forum

Playwright Java Gradle

Hey new friends,

I want to start using Java Playwright with gradle as the build tool. The problem is that all the docs only use maven and I cannot find the gradle equvilent on the playwright website. Here is an example: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip" How do I run this command in with gradle?

Thanks for you help 🙂

This thread is trying to answer question "How do I run a Java Playwright command with Gradle?"

7 replies
plugins {
    application
    kotlin("jvm") version "1.8.0"
}

application {
    mainClass.set("com.microsoft.playwright.CLI")
}
./gradlew run --args="show-trace trace.zip"

something like this probably

not a java playwright user myself though

task showTrace(type: JavaExec) {
    main = 'com.microsoft.playwright.CLI'
    args = ["show-trace", "trace.zip"]
    classpath = sourceSets.main.runtimeClasspath
}
./gradlew showTrace

or this

ok thank you really much, but how do I cone up with this code?

is there no playwright gradle docs?

looks like there isn't

feel free to contribute if you'd like

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.