fantoccini icon indicating copy to clipboard operation
fantoccini copied to clipboard

Provide fallbacks for getWindowRect and setWindowRect

Open jonhoo opened this issue 6 years ago • 8 comments

These should fall back to individual calls to (get/set)WindowSize + (get/set)WindowPosition if the Rect commands return "unknown command". See the commit that introduces rect to the selenium JS bindings: https://github.com/SeleniumHQ/selenium/commit/6103ef6c923ea43c71779be9a05cc3a6248d1b53

/cc @Phrohdoh

jonhoo avatar May 13 '18 19:05 jonhoo

See also https://github.com/jonhoo/fantoccini/commit/d2843b0f37bb5deb8b3eb25a4c8a86b99aad7348

jonhoo avatar May 13 '18 19:05 jonhoo

AFAICT there are no such commands as the spec only lists SetWindowRect and GetWindowRect.

phrohdoh avatar May 14 '18 13:05 phrohdoh

Yeah, the spec only has those, but to be helpful there are a couple of places where we fall back to the original Selenium protocol (this is what the legacy field is for).

jonhoo avatar May 14 '18 16:05 jonhoo

Oh I see, I did not understand previously. Sounds easy enough.

phrohdoh avatar May 14 '18 17:05 phrohdoh

It looks like there are also some test failures in Chrome on macOS: https://travis-ci.org/jonhoo/fantoccini/jobs/378871411#L873. My guess is that it's related to the window decorations causing an offset in the returned values (see https://github.com/SeleniumHQ/selenium/blob/6103ef6c923ea43c71779be9a05cc3a6248d1b53/javascript/node/selenium-webdriver/test/window_test.js#L125)

jonhoo avatar May 14 '18 19:05 jonhoo

Sadly these tests also fail when running on a machine with a tiling window manager :(

jonhoo avatar May 21 '18 15:05 jonhoo

@jonhoo I'm running into this with thirtyfour now. I notice the relevant tests are marked as ignored for now. It seems chromedriver returns only the width and height in this situation, which to my reading goes against the spec. Is this actually a bug in chromedriver on MacOS? I'm happy to raise an issue there given that it's quite easy to reproduce.

I'll probably mask the test failure in thirtyfour for now.

stevepryde avatar Jul 24 '22 06:07 stevepryde

Could very well be — I've lost the context on this in the intervening years :sweat_smile:

jonhoo avatar Jul 26 '22 11:07 jonhoo