chromium-bidi
chromium-bidi copied to clipboard
Wrong events coordinates in iFrames
In input.performActions command, with origin: "viewport" and context of iframe, the wrong coordinates are used.
- The WebDriver specification get coordinates relative to an origin requires the coordinates to be used are relative to the provided context's viewport.
- The Mapper uses CDP method
Input.dispatchMouseEvent, which uses coordinated "relative to the main frame's viewport".
We can try to traverse up the frame tree and try to get the frame offset. This approach wouldn't work for shadow tree though
But the Shadow DOM doesn't have its own viewport. It's sharing it with the viewport of the main document. Or am I wrong? But it could happen that there is an iframe within the Shadow DOM which indeed would have to be taken into account. I don't think that we have a test case for that yet.
This sounds similar to what I reported half a year ago in https://issues.chromium.org/issues/359616812 . Probably that bug report should live in this project rather.
I have a small standalone reproducer for this bug:
git clone https://github.com/martinpitt/bidi-test
cd bidi-test
python3 -m http.server
./bidimouse.py
The https://github.com/martinpitt/bidi-test has details about this bug and how to run it.