'How can I detect the mouse position ACCORDING TO ITS RELATIVE POSITION

How can I detect the mouse position ACCORDING TO ITS RELATIVE POSITION

I mean if I'm in the middle of the page and I log the mouse positionX (I want to log 0) And if i moved the mouse to the left / right 1px (I want to log 1) How can I do that? I searched alot and all I found clientX; pageX; offsetLeft; etc.. Thanks all 🙏



Solution 1:[1]

  1. Use more specific selector:
await page.click('input.ars[type="password"]');
  1. Or use indexed element handles:
const elements = await page.$$('input.ars');
await elements[1].click();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vsemozhebuty