mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix: compute click center from full box model quad
This commit is contained in:
@@ -126,9 +126,10 @@ export async function automateUploadMedia(options) {
|
|||||||
const clickNode = async (nodeId) => {
|
const clickNode = async (nodeId) => {
|
||||||
const { model } = await sendCommand('DOM.getBoxModel', { nodeId });
|
const { model } = await sendCommand('DOM.getBoxModel', { nodeId });
|
||||||
if (!model?.content) return;
|
if (!model?.content) return;
|
||||||
const [x1, y1, x2, y2] = model.content;
|
const content = model.content;
|
||||||
const x = (x1 + x2) / 2;
|
if (content.length < 8) return;
|
||||||
const y = (y1 + y2) / 2;
|
const x = (content[0] + content[2] + content[4] + content[6]) / 4;
|
||||||
|
const y = (content[1] + content[3] + content[5] + content[7]) / 4;
|
||||||
await sendCommand('Input.dispatchMouseEvent', {
|
await sendCommand('Input.dispatchMouseEvent', {
|
||||||
type: 'mousePressed',
|
type: 'mousePressed',
|
||||||
x,
|
x,
|
||||||
|
|||||||
Reference in New Issue
Block a user