Skip to content

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

Open
@jgraham

Description

@jgraham

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):

  • Return false in the setWindowRect capability because the implementation doesn't support all the window resizing and repositioning commands (although arguably it does support all the commands, just not fully).
  • Support setWindowRect, but fail the command entirely if either x or y arguments are provided
  • Support setWindowRect, but just ignore any x and y arguments (the spec's language around "implementation defined steps" would arguably allow this, but it wouldn't have the desired effect).

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions