w3c / w3c/webdriver

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

Open
#1,826 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Get Window Rect Set Window Rect
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the setWindowRect command and WindowRect behavior described in this issue, including the Wayland limitation. Compare the proposed handling of x and y with the existing WebDriver specification and compatibility concerns. Done means reaching a decided normative clarification, not merely documenting the alternatives.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.