https://github.com/christian-draeger/playwright-kotlin
A Kotlin DSL over Playwright Java to write sleek browser automations.
https://github.com/christian-draeger/playwright-kotlin
Last synced: about 2 months ago
JSON representation
A Kotlin DSL over Playwright Java to write sleek browser automations.
- Host: GitHub
- URL: https://github.com/christian-draeger/playwright-kotlin
- Owner: christian-draeger
- License: mit
- Created: 2025-07-30T11:49:15.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-07-31T12:53:21.000Z (2 months ago)
- Last Synced: 2025-08-09T12:44:25.919Z (2 months ago)
- Language: Kotlin
- Size: 99.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Playwright Kotlin [](https://github.com/christian-draeger/playwright-kotlin/actions/workflows/build.yml) 
A Kotlin DSL over Playwright Java to write seek browser automations.
## Installation
```kotlin
implementation("codes.draeger:playwright:tbd")
```## Usage
```kotlin
@Test
fun `playwright exploration test`() {
val allTitles = playwright {
browser {
page {
+"https://playwright.dev/"screenshot {
path = Path("screenshots/example.png")
}".footer a" { // can invoke css selector to be evaluated as locator
hasText = "Getting started" // can directly set locator options
// returns the locator to be able to chain or store locator in a variable
}.click {
button = MouseButton.LEFT // can directly set click options
// returns the clicked locator to be able to chain further
}screenshot {
// can directly set screenshot options
path = Path("screenshots/getting-started.png")
}// can use xpath to be evaluated as locator and return a list of locators
val allFooterLinkLocators =
"//footer//a" {}.all() // can use xpath to be evaluated as locator and return a list of locators// return all footer links
allFooterLinkLocators.map { it.textContent() to it.getAttribute("href") }
}
}
}println(allTitles)
}
```---
## 📄 License
This repository is licensed under the [MIT License](LICENSE).
---
With this template, you can focus on writing great code while the boilerplate tasks are taken care of. Happy coding! 🎉