Hover bewegt nur noch (kein Klick) - sonst klickte --hover den Knopf

This commit is contained in:
2026-12-04 21:24:13 +01:00
parent 45fe76310f
commit d3c67a4ca9
+3 -2
View File
@@ -194,7 +194,7 @@ async function main() {
const i = ++nr; wartend.set(i, res); ws.send(JSON.stringify({ id: i, method, params }));
});
await senden("Runtime.enable");
const werten = async (expr) => {
const werten = async (expr, klicken = true) => {
const r = await senden("Runtime.evaluate",
{ expression: VORSPANN + "\n" + expr, returnByValue: true, awaitPromise: true });
if (r.result?.exceptionDetails) return "Fehler: " + JSON.stringify(r.result.exceptionDetails).slice(0, 300);
@@ -206,6 +206,7 @@ async function main() {
await senden("Input.dispatchMouseEvent", { type: "mouseMoved", x, y, button: "none" });
await new Promise((ok) => setTimeout(ok, 6 + Math.floor(Math.random() * 9)));
}
if (!klicken) return "gezeigt: " + p.text;
await new Promise((ok) => setTimeout(ok, p.steh)); // kurz stehen, dann druecken
await senden("Input.dispatchMouseEvent",
{ type: "mousePressed", x: zx, y: zy, button: "left", clickCount: 1 });
@@ -218,7 +219,7 @@ async function main() {
};
if (args.includes("--hover")) { // nur hinsehen: Zeiger auf einen Knopf
const wert = await werten(HOVER);
const wert = await werten(HOVER, false);
if (typeof wert === "string" && wert.startsWith("CDP ")) {
const p = JSON.parse(wert.slice(4));
for (const [x, y] of p.pfad) {