chore: recovery 2 (#5014) merge to 3.11 (#5175)

Co-authored-by: Alireza <ar.sedghi@gmail.com>
Co-authored-by: Dan Rukas <dan.rukas@gmail.com>
Co-authored-by: Tang Cheng <45505657+tctco@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-07-03 14:08:46 -04:00
1 parent 17ed63eb1d
commit 24e0263fb9
44 files changed
+516 -258

No files matched your search

+6 -6
View File
@@ -5,21 +5,21 @@ interface WindowWithMousePosition extends Window {
mouseY: number;
}
export const initilizeMousePositionTracker = async (page: Page) => {
const window = await page.evaluateHandle("window") as any;
export const initializeMousePositionTracker = async (page: Page) => {
const window = (await page.evaluateHandle('window')) as any;
await page.evaluate((window: WindowWithMousePosition) => {
window.mouseX = 0;
window.mouseY = 0;
window.addEventListener("mousemove", (event) => {
window.addEventListener('mousemove', event => {
window.mouseX = event.clientX;
window.mouseY = event.clientY;
});
}, window);
}
};
export const getMousePosition = async (page: Page) => {
const window = await page.evaluateHandle("window") as any;
const window = (await page.evaluateHandle('window')) as any;
return await page.evaluate((window: WindowWithMousePosition) => {
return { x: window.mouseX, y: window.mouseY };
}, window);
}
};