microsoft / microsoft/playwright-java
[Feature]: Support for Playwright Test Agents (Planner, Generator, Healer) in Java
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 1.6k
- Forks
- 298
- Merge moyen
- 3 j 2 h
- PR mergées (30 j)
- 14
Description
🚀 Feature Request
Description
Playwright v1.56+ introduced the Agentic Workflow (planner, generator, and healer) which has significantly improved the efficiency of test authoring and maintenance for Node.js users. However, these tools are currently not accessible to teams using the Java bindings.
As a Java user, I would like to leverage the AI-powered Healer Agent to automatically repair failing tests by inspecting the UI and updating locators, just as it is currently possible with npx playwright init-agents --loop=vscode.
Motivation
Many enterprise environments rely on Java for their test automation infrastructure. Currently, Java users have to:
Manually debug and fix locators.
Use third-party proxies (like Healenium) which require additional infrastructure.
Maintain separate Node.js environments just to utilize the AI agents.
Bringing parity to the Java library would allow us to integrate self-healing directly into our JUnit/TestNG workflows.
Proposed Implementation
CLI Support: Add agent initialization to the Playwright Java CLI (e.g., mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="init-agents").
Healer Integration: Allow the Healer to analyze Java test failures and suggest/apply patches to .java source files or Page Object Models.
Documentation: Provide a guide on how to configure the agentic loop within a Maven/Gradle project.
Example Use Case
When a locator in a Page Object fails:
Java
// Page Object
private final Locator submitButton;
public LoginPage(Page page) {
this.submitButton = page.locator("#old-id"); // This ID changed to #new-id
}
The Healer Agent should detect the TimeoutError, scan the DOM, identify the new ID, and suggest the fix directly in the console or IDE.
Example
No response
Motivation
Playwright has it for Javascript/Typscript (which I played with on my own and thought it was cool). But the test automation project that I am working was written with Java using the Selenium library. I added Playwright to the project due to 1) able to inject API responses and 2) able to execute using for Safari/Webkit (due to security the automation scripts have to set the user-agent value that Safari does not allow us to do). This would be able another cool feature.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par examiner le point d’entrée de la CLI Java de Playwright, com.microsoft.playwright.CLI, et la manière dont les projets Java Maven/Gradle l’invoquent. Clarifiez le périmètre prévu pour l’initialisation de l’agent, la gestion des échecs des tests Java, l’application de correctifs aux fichiers sources et la documentation ; la définition de terminé devrait inclure une limite d’implémentation convenue et la validation du workflow pris en charge.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- cli, testing-qa
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Calme
- Clarté
- À clarifier
- Accessibilité débutants
- 30/100