-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Open
Description
Version
1.53.0
Steps to reproduce
I'm testing a poorly written Android Hybrid app which does not properly destroy webviews when exited.
Steps to reproduce:
import { _android as android } from "playwright";
const [device] = await android.devices();
const webview = await device.webView({
pkg: "myapp.webview.pkg.id",
});
console.log("webview got", webview.pid(), webview.pkg());
const initialPage = await webview.page();
console.log("page got", initialPage.url());
const pages = initialPage.context().pages();
for (const p of pages) {
const isRendering = await p.evaluate(() => {
return new Promise((res) => {
const timer = setTimeout(() => {
res(false);
}, 100);
requestAnimationFrame(() => {
clearTimeout(timer);
res(true);
});
});
});
console.log(isRendering);
}Expected behavior
I can use the raf trick to check whether the page is hidden/detached or visible.
Maybe playwright can let us customize page retrieval timeout or incorporate the raf trick to the server side or expose a new API webview.pages() and let user check whether the page is hidden/detached or visible.
Actual behavior
Sometimes webview.page() will hang forever, I suspect it's due to playwright is connecting to a detached or hidden webview page, and the timeout is set to 0 at server side.
Sometimes the page can be returned by webview.page, but it indeed is detached or hidden, which making moves in it seems useless.
Additional context
Environment
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M2
Memory: 177.14 MB / 16.00 GB
Binaries:
Node: 22.15.0 - /Users/crazyones110/.local/state/fnm_multishells/2688_1764752400833/bin/node
Yarn: 1.22.22 - /Users/crazyones110/.local/state/fnm_multishells/812_1764752170871/bin/yarn
npm: 10.9.2 - /Users/crazyones110/.local/state/fnm_multishells/2688_1764752400833/bin/npm
pnpm: 10.22.0 - /Users/crazyones110/.local/state/fnm_multishells/2688_1764752400833/bin/pnpm
IDEs:
VSCode: 1.106.3 - /usr/local/bin/code
Cursor: 0.45.14 - /usr/local/bin/cursor
Claude Code: 1.2.0 - /Users/crazyones110/.local/state/fnm_multishells/812_1764752170871/bin/claude
Languages:
Bash: 3.2.57 - /bin/bash
npmPackages:
playwright: 1.53.0 => 1.53.0Metadata
Metadata
Assignees
Labels
No labels