w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
676 stars 190 forks source link

Clarify behaviour of setWindowRect when only setting window size or position is possible #1826

Open jgraham opened 1 week ago

jgraham commented 1 week ago

Linux running Wayland doesn't allow applications to set (or know) their screen coordinates, but does allow them to specify the size.

Currently in WebDriver one can imagine handling this in multiple different ways (not all mutually exclusive):

In practice I suspect that for compatibility with existing tests we'd be best off with only the third option i.e. silently ignore any attempts to set x and y in setWindowRect. That's because I suspect a lot of tests start by trying to set the window to a known size and position for consistency. They almost never actually care what the window position is, only that it's visible.

However that seems least in the spirit of the current spec and could surprise test authors in the (rare?) case that they really do care about the position for whatever reason. That said they get the WindowRect in the return value, so you can at least notice that the return value didn't match what you asked for (which can already be the case in some scenarios).

A sort of in-between option would be to fail the command if you only get x and y arguments i.e. don't get either width or height. That might catch some cases where people really are trying to set the window position. But it might also cause unnecessary breakage in cases where they don't really care about the window position, but just happen to be setting the position in a different command for some reason.

My sense if that we should clarify the spec to make it optional to actually move the window when x and y are supplied, and if authors really care whether that move happened they need to check the return value. That's not very theoretically pure, but does seem likely to break the fewest users, so I think it's preferred from a priority of constituencies point of view. But other input would be very appreciated.

whimboo commented 6 days ago

CC'ing @OrKoN, @sadym-chromium and @gsnedders to get input from Google and Apple.