You are viewing a plain text version of this content. The canonical link for it is here.
Posted to geb-notifications@groovy.apache.org by "jamesfredley (via GitHub)" <gi...@apache.org> on 2026/07/22 17:57:05 UTC
[PR] Add optional geb-direct Playwright backend [groovy-geb]
jamesfredley opened a new pull request, #330:
URL: https://github.com/apache/groovy-geb/pull/330
## Summary
Optional Playwright-backed driver for Geb (`geb-direct`), without changing the default Selenium WebDriver path.
Geb remains WebDriver-centric. This module implements a Playwright-backed `WebDriver` / `WebElement` adapter so existing Geb surfaces (`Browser`, Page Objects, content DSL, `$()`, `waitFor`, modules, reporting integrations) keep working when users opt in.
### Motivation
Selenium-backed browser tests are often flaky in CI: brittle waits, remote driver/container networking, and weak debugging. Playwright provides:
- BrowserContext isolation
- Locator auto-waiting for actionable elements
- Strong locator strategies (role/text/test id/label/placeholder)
- Tracing (screenshots/DOM/network)
- Video recording
- Network interception
`geb-direct` brings those strengths in as an **opt-in** backend.
## Generic design
| Concern | Approach |
|---|---|
| Default Geb path | Unchanged Selenium WebDriver |
| Opt-in | `driver = PlaywrightDriver.config { ... }` in `GebConfig` |
| Coordinates | `org.apache.groovy.geb:geb-direct` (same version line as other Geb modules) |
| Implementation | Playwright Java -> Selenium `WebDriver` adapter |
| Isolation | One Playwright context per driver instance |
| Auto-wait | Locator-backed click/fill/clear |
| Advanced APIs | `PlaywrightBrowserSupport` facades (network, tracing, locators, wait, storage, emulation, downloads, HAR, console, API, PDF, a11y, video) |
| Threading | Not thread-safe; use `cacheDriverPerThread` under parallel workers |
### Configuration example
```groovy
import geb.direct.PlaywrightDriver
driver = PlaywrightDriver.config {
browserType = 'chromium' // firefox | webkit
headless = true
// tracing = true
// recordVideo = true
}
```
### Browser install
```bash
npx playwright install chromium
# or module task:
./gradlew :module:geb-direct:installPlaywrightBrowsers
```
Skip browser tests: `-Dgeb.direct.playwright.skip=true` or `PLAYWRIGHT_SKIP=true`.
### Module layout
- `module/geb-direct` - adapter + facades + tests + README
- Manual chapter: `doc/manual/src/docs/asciidoc/022-geb-direct.adoc`
- CI: Playwright Chromium install before `check` in `build-check.yml`
### Verification (local)
- 45 module tests green
- JaCoCo line coverage gate (85%+)
- CodeNarc + RAT clean on the module
### Known initial-adapter limits
- Not every Selenium edge case is 1:1 (some window-manager/alert paths are best-effort)
- Selenium-style `Browser.networkLatency` is not mapped yet
- Cookie APIs are scoped to the current document host (WebDriver semantics)
## Grails-specific validation
Grails 8 currently drives Geb through **Testcontainers + Selenium** (`ContainerGebSpec` / `BrowserWebDriverContainer`). That stack is a major source of CI pain.
| | Selenium + Testcontainers (current Grails) | Playwright local (`geb-direct`) |
|---|---|---|
| Browser | Docker Selenium image | Local Chromium via Playwright |
| App under test | Host `@Integration` server | Same |
| Reach app | `host.testcontainers.internal:port` | `http://localhost:$serverPort` |
| File upload | Remote `FileDetector` / copy into container | Normal local filesystem paths |
| Waiting | Geb wait + Selenium implicit wait hazards | Locator auto-wait + Geb `waitFor` |
| Recording | VNC MP4 via Testcontainers | Playwright video/trace |
| Docker required for browser | Yes | **No** |
**Do you still need Testcontainers with Playwright?**
- **Browser: no** (local Playwright is enough)
- **Databases / other infra: yes** (Mongo/Postgres/etc. still fine via Testcontainers)
### Proof branch on grails-core (no PR opened)
Branch (based on `8.0.x`):
https://github.com/apache/grails-core/tree/feature/grails-geb-playwright-local
Adds:
- `PlaywrightGebSpec` + `GrailsPlaywrightGebExtension` + `PlaywrightBrowserHolder`
- Optional dependency on `geb-direct` / Geb `8.0.2-SNAPSHOT` (mavenLocal for validation)
- Tagged examples (`playwright-geb`): context-path, GebConfig, wait/type/click stress, local upload
Re-run on that branch:
```powershell
# once
npx playwright install chromium
# from groovy-geb feature branch
./gradlew.bat publishToMavenLocal
cd <grails-core checkout of feature/grails-geb-playwright-local>
./gradlew.bat :grails-test-examples-geb:integrationTest `
:grails-test-examples-geb-context-path:integrationTest `
:grails-test-examples-geb-gebconfig:integrationTest `
-PincludeTestTags=playwright-geb
```
Result of that validation: **5 tests, 0 failures** against live Grails `@Integration` apps.
## Mailing-list alignment
This matches the optional `geb-direct` / `org.apache.groovy.geb` direction discussed on the Groovy mailing list: keep Selenium default, add Playwright as opt-in, preserve Geb DSL.
## Checklist
- [x] Optional module; default Selenium path untouched
- [x] Module tests + docs
- [x] CI browser install hook
- [x] Grails 8.0.x proof branch linked (no Grails PR)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5164900230
@jamesfredley This is really cool!
Why the name `geb-direct`? Would not `geb-playwright` be more suitable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5165717242
@matrei Thank you, I am hopeful this resolves our flaky test issues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5050117977
CI failure root cause: `ManualAnchorsSpec` duplicate header ids from the new geb-direct chapter (e.g. Installation colliding with Installation & usage). Fixed in the latest commit by giving every section an explicit unique AsciiDoc anchor (`[[geb-direct-...]]`). Verified locally with `:doc:site:test --tests geb.ManualAnchorsSpec`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5049866667
## Copilot review follow-up (39e03279)
Addressed the valid review comments and the CI failure:
| Thread | Action |
|---|---|
| `previousSize` unused in `PlaywrightWindow` | Removed dead field; maximize/fullscreen are viewport best-effort; minimize is an explicit no-op |
| `By.className` digit identifiers | Use `[class~="..."]` when not a valid CSS identifier; added unit test |
| `unrouteFromHAR` clears all routes | Documented Playwright limitation; deprecated path overload; added explicit `unrouteAll()` |
| Redundant Selenium imports | Dropped duplicates; kept `org.openqa.selenium.*` |
| Unused `Locator` import in core spec | Removed (this was the `codenarcTest` CI break) |
| `Path` unused in `PlaywrightNetwork` | **Not valid** - still used by `routeFromHAR(Path)` / `Path.of(...)` |
### CI
`Build, test, and quality check` failed on `:module:geb-direct:codenarcTest` (unused import), not on the Playwright tests themselves. Local verification after the fix:
- `:module:geb-direct:codenarcMain` / `codenarcTest` green
- `:module:geb-direct:test` green
- JaCoCo gate green
All six Copilot review threads marked resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "sbglasius (via GitHub)" <gi...@apache.org>.
sbglasius commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5352949692
I think the name is less important, more important is to get it into Geb
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add experimental geb-playwright driver [groovy-geb]
Posted by "jonnybot0 (via GitHub)" <gi...@apache.org>.
jonnybot0 commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5920562776
Looks good. I just resolved the merge conflict. Once the checks pass, we should be good to merge. May need to make some fix-forward changes later, but this seems as good a place to start as any.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add experimental geb-playwright driver [groovy-geb]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5918819571
## Simplification pass
Question for this change: is a Playwright backend for Geb the smallest thing that still lets existing Geb code run? The previous draft answered that by re-implementing Playwright.
`geb-direct` is now `geb-playwright` (`org.apache.groovy.geb:geb-playwright`, package `geb.playwright`) and is marked experimental in the manual, README, and POM. The API is not a compatibility commitment.
### Removed
These types only forwarded to `Page` or `BrowserContext`. Call those objects on the driver instead.
- `PlaywrightBrowserSupport`
- `PlaywrightNetwork`, `PlaywrightTracing`, `PlaywrightLocators`, `PlaywrightWait`
- `PlaywrightKeyboard`, `PlaywrightMouse`, `PlaywrightTouchscreen`
- `PlaywrightStorage`, `PlaywrightEmulation`, `PlaywrightDownloads`, `PlaywrightHar`
- `PlaywrightConsole`, `PlaywrightApiClient`, `PlaywrightCoverage`, `PlaywrightPdf`
- `PlaywrightAccessibility`, `PlaywrightVideoSupport`
Also removed the tests that existed to walk those wrappers (`PlaywrightFacadeCoverageSpec`, `PlaywrightAdvancedFeaturesSpec`, `PlaywrightHelpersSpec`), plus `PlaywrightWebDriverSmokeSpec` and `PlaywrightWebDriverSpec`, which repeated the core adapter specs and pulled in Jetty for one page. The Jetty test dependencies went with them.
`PlaywrightWebElement` no longer adds Playwright methods that are not part of `WebElement` (`hover`, `selectOption`, `dragTo`, and the rest). `PlaywrightOptions.copy()` no longer lists every field by hand. `PlaywrightDriver.config` and `create` share one closure applicator. The session no longer records console messages and page errors that only the deleted console wrapper read.
### Kept
The WebDriver surface Geb actually calls:
- `PlaywrightDriver`, `PlaywrightOptions`, `PlaywrightSession`
- `PlaywrightWebDriver`, `PlaywrightWebElement`, `PlaywrightBy`
- navigation, cookies, timeouts, frames, windows, alerts
- `PlaywrightTraceReporter`, which is a Geb reporter, not a Playwright wrapper
Playwright-only work:
```groovy
def playwrightDriver = browser.driver as PlaywrightWebDriver
playwrightDriver.page.getByTestId('submit').click()
playwrightDriver.context.route('**/api/**') { route -> route.abort() }
```
### Tests
`:module:geb-playwright:check` passed locally (CodeNarc, module tests, JaCoCo line coverage at 85%, RAT). Cookie add/read/HttpOnly and each delete path are asserted separately. Viewport size is asserted before maximize/fullscreen overwrite it.
Diff against the previous tip: 53 files, +414 / −2053.
The Grails 8 proof branch still depends on the old `geb-direct` coordinates and was not re-run after this rename.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5197966326
Wouldn't reactive be better? it's only direct because it doesn't use polling. it uses push?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5356681867
> I think the name is less important, more important is to get it into Geb
I disagree, naming is extremely important, and hard to change afterwards.
It's one of the two hard things in computer science you know :wink:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#discussion_r3632617829
##########
module/geb-direct/src/main/groovy/geb/direct/PlaywrightWindow.groovy:
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package geb.direct
+
+import org.openqa.selenium.*
+
+@SuppressWarnings('UnnecessarySetter')
+class PlaywrightWindow implements WebDriver.Window {
+ private static final Dimension FULLSCREEN_SIZE = new Dimension(1920, 1080)
+ final PlaywrightWebDriver driver
+ private Point logicalPosition = new Point(0, 0)
+ private Dimension previousSize
+
+ PlaywrightWindow(PlaywrightWebDriver driver) { this.driver = driver }
+ Dimension getSize() { def size = driver.page.viewportSize(); new Dimension(size.width, size.height) }
+ void setSize(Dimension targetSize) { driver.page.setViewportSize(targetSize.width, targetSize.height) }
+ // Playwright cannot move the native browser window, so preserve a logical position for WebDriver callers.
+ Point getPosition() { new Point(logicalPosition.x, logicalPosition.y) }
+ void setPosition(Point targetPosition) { logicalPosition = new Point(targetPosition.x, targetPosition.y) }
+ void maximize() { previousSize = getSize(); setSize(FULLSCREEN_SIZE) }
+ void minimize() { previousSize = getSize() }
+ void fullscreen() { setSize(FULLSCREEN_SIZE) }
Review Comment:
`previousSize` is assigned in `maximize()`/`minimize()` but never read, which is likely to trip CodeNarc's unused rules and also adds dead state. Since Playwright cannot minimize/maximize native browser chrome, consider removing the field and making these methods best-effort viewport operations (with `minimize()` as an explicit no-op).
##########
module/geb-direct/src/main/groovy/geb/direct/PlaywrightBy.groovy:
##########
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package geb.direct
+
+import org.openqa.selenium.By
+
+/**
+ * Maps Selenium {@link By} locators to Playwright selector strings.
+ * <p>
+ * Selenium's {@code By.toString()} format is {@code By.<strategy>: <value>}
+ * (for example {@code By.cssSelector: .notice}).
+ */
+final class PlaywrightBy {
+
+ private PlaywrightBy() {
+ }
+
+ static String selector(By by) {
+ if (by == null) {
+ throw new IllegalArgumentException('Locator must not be null')
+ }
+
+ String description = by
+ def matcher = (description =~ /^By\.([A-Za-z]+):\s*(.*)$/)
+ if (!matcher.matches()) {
+ throw new IllegalArgumentException("Unsupported locator: $by")
+ }
+
+ String strategy = matcher.group(1).toLowerCase(Locale.ROOT)
+ String value = matcher.group(2)
+
+ switch (strategy) {
+ case 'cssselector':
+ case 'css selector':
+ return value
+ case 'xpath':
+ return "xpath=${value}"
+ case 'id':
+ return value ==~ /[A-Za-z_][A-Za-z0-9_-]*/ ? "#${value}" : "[id=\"${cssString(value)}\"]"
+ case 'name':
+ return "[name=\"${cssString(value)}\"]"
+ case 'classname':
+ case 'class name':
+ return ".${cssEscape(value)}"
Review Comment:
`By.className` values are not guaranteed to be valid unescaped CSS class identifiers (e.g. a class starting with a digit). Returning `.${...}` can therefore produce an invalid selector or change matching semantics. For non-CSS-identifier class names, use an attribute selector (`[class~="..."]`) to preserve WebDriver semantics.
##########
module/geb-direct/src/main/groovy/geb/direct/PlaywrightHar.groovy:
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package geb.direct
+
+import java.nio.file.Path
+
+class PlaywrightHar {
+ final PlaywrightWebDriver driver
+ PlaywrightHar(PlaywrightWebDriver driver) { this.driver = driver }
+ void routeFromHAR(Path path) { driver.context.routeFromHAR(path) }
+ void routeFromHAR(String path) { routeFromHAR(Path.of(path)) }
+ @SuppressWarnings('UnusedMethodParameter')
+ void unrouteFromHAR(Path path) { driver.context.unrouteAll() }
+}
Review Comment:
`unrouteFromHAR(Path)` currently ignores the `path` argument and calls `BrowserContext.unrouteAll()`, which removes *all* routing handlers (including any routes registered via `PlaywrightNetwork.route(...)`), not just HAR routing. This is surprising given the method name/signature; consider either renaming to reflect that it clears all routes, or documenting/throwing `UnsupportedOperationException` for the path-specific variant and offering an explicit `unrouteAll()` helper.
##########
module/geb-direct/src/main/groovy/geb/direct/PlaywrightNetwork.groovy:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package geb.direct
+
+import com.microsoft.playwright.Route
+import java.nio.file.Path
+import java.util.concurrent.ConcurrentHashMap
+import java.util.function.Consumer
Review Comment:
`java.nio.file.Path` is imported but not used in this class, which is likely to be flagged by CodeNarc's unused import checks. Remove the unused import to keep the module lint-clean.
##########
module/geb-direct/src/main/groovy/geb/direct/PlaywrightWebDriver.groovy:
##########
@@ -0,0 +1,293 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package geb.direct
+
+import com.microsoft.playwright.*
+import org.openqa.selenium.*
+import org.openqa.selenium.Capabilities
+import org.openqa.selenium.HasCapabilities
+import org.openqa.selenium.ImmutableCapabilities
+import org.openqa.selenium.JavascriptExecutor
+import org.openqa.selenium.TakesScreenshot
+import org.openqa.selenium.WebDriver
+import org.openqa.selenium.interactions.Interactive
+import org.openqa.selenium.interactions.Sequence
+import org.openqa.selenium.logging.Logs
+import com.microsoft.playwright.options.WaitForSelectorState
Review Comment:
The explicit Selenium imports (`Capabilities`, `WebDriver`, `TakesScreenshot`, etc.) are redundant because `import org.openqa.selenium.*` already covers them; this adds noise and can be flagged by static analysis as unnecessary imports. Consider keeping the wildcard import and removing the duplicates (or vice versa).
##########
module/geb-direct/src/test/groovy/geb/direct/PlaywrightWebDriverCoreSpec.groovy:
##########
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package geb.direct
+
+import com.microsoft.playwright.Locator
+import com.microsoft.playwright.PlaywrightException
+import geb.direct.support.PlaywrightSpecSupport
+import com.sun.net.httpserver.HttpServer
Review Comment:
`com.microsoft.playwright.Locator` is imported but not referenced in this spec, which is likely to trigger CodeNarc's unused import checks. Remove the unused import to keep the test suite lint-clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5165710247
I did start at `geb-playwright` and then landed at `geb-direct`
### Other options I considered:
| Name | Pros | Cons | Verdict |
|-------------------|-------------------------------------------|-------------------------------------------|--------------|
| **geb-direct** | Clear, short, highlights the protocol advantage | Slightly vague on first read | **Best** |
| **geb-native** | Emphasizes native browser protocols | Could be confused with "native mobile" | Good |
| **geb-engine** | Sounds technical | Too generic | Okay |
| **geb-playwright**| Most discoverable | could be confusing | Fallback |
| **geb-cdp** | Technically accurate for Chromium | Too narrow (ignores Firefox/WebKit) | Not great |
---
- It clearly signals the **key architectural difference**: direct communication with the browser engine (via CDP and equivalent protocols) instead of going through the Selenium/WebDriver abstraction layer.
- Short, Groovy-style, and easy to say.
- "Direct" tells people exactly what they're getting — lower-level, more powerful browser control without the extra translation hop.
- It doesn't tie the module name too tightly to the Playwright library itself (even though Playwright would be the implementation underneath). This leaves room later if someone wanted to add other direct-protocol backends.
Playwright communicates **directly** with the browser engines using their native low-level debugging/automation protocols:
Chromium → Chrome DevTools Protocol (CDP)
Firefox → Firefox Remote Debugging Protocol
WebKit → WebKit Remote Debugging Protocol
Playwright skips the WebDriver server entirely. Its Java (or Node) client talks more **directly** to the browser process using the engine’s own protocol.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add experimental geb-playwright driver [groovy-geb]
Posted by "jonnybot0 (via GitHub)" <gi...@apache.org>.
jonnybot0 merged PR #330:
URL: https://github.com/apache/groovy-geb/pull/330
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5346856510
I still lean towards geb-direct.
If that gets voted down strongly, geb-playwright would be my next vote.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add optional geb-direct Playwright backend [groovy-geb]
Posted by "jonnybot0 (via GitHub)" <gi...@apache.org>.
jonnybot0 commented on PR #330:
URL: https://github.com/apache/groovy-geb/pull/330#issuecomment-5784624329
Hey! Late to the party, but I'm on team `geb-playwright`, as I noted on the mailing list. Do that, and you get a ✅ from me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: geb-notifications-unsubscribe@groovy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org