Open CanadaHonk opened 1 year ago
So I propose we do this as follows:
A command browser.getWindows()
that provides a list of WindowInfo
objects which might look something like:
browser.Window = text # Window Id
browser.WindowInfo = {
window: browser.Window,
contexts: [*browsingContext.Context], # Top level browsing contexts
bounds: browser.WindowBounds
}
browser.WindowBounds = {
top: js-uint,
left: js-uint,
width: js-uint,
height: js-uint,
state: "normal" / "maximized" / "minimized" / "fullscreen",
}
The command should allow providing a list of contexts or window ids to limit the results to just those windows or the windows containing those contexts.
If that already provides the bounds we don't need a separate getter command. But we'd want a browser.setWindowBounds
command with parameters like:
browser.SetWindowBoundsParameters = {
window: browser.Window,
bounds: browser.WindowsBoundsParameters
}
browser.WindowsBoundsParameters = browser.WindowState // browser.WindowRect
browser.WindowState = {
type: "maximized" / "minimized" / "fullscreen"
}
browser.WindowRect = {
type: "rect",
top: js-uint,
left: js-unit,
width: js-uint,
height: js-unint
}
The Browser Testing and Tools Working Group just discussed Resize and positioning windows
.
See WebDriver classic spec: https://www.w3.org/TR/webdriver/#resizing-and-positioning-windows See also CDP equivalents: https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getWindowBounds & https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-setWindowBounds