window-manager module

WindowProperties()

A set of properties describing a window and that should allow to uniquely identify it. The described window can either be a Chrome Window or a Content Window.

Arguments
  • win (Window) – The Chrome Window containing the window. When describing a Chrome Window, this is the window itself.

  • id (String) – The unique id of the containing Chrome Window.

  • hasTabBrowser (Boolean) – true if the Chrome Window has a tabBrowser.

  • tabIndex (Number) – Optional, the index of the specific tab within the window.

class WindowManager()

Provides helpers to interact with Window objects.

WindowManager.closeWindow(win)

Close the specified window.

Arguments
  • win (window) – The window to close.

Returns

Promise – A promise which is resolved when the current window has been closed.

WindowManager.findWindowByHandle(handle)

Find a specific window matching the provided window handle.

Arguments
  • handle (Number) – The unique handle of either a chrome window or a content browser, as returned by #getIdForBrowser() or #getIdForWindow().

Returns

Object – A window properties object,

See also

  • :js:func:`GeckoDriver#getWindowProperties`

WindowManager.focusWindow(win)

Focus the specified window.

Arguments
  • win (window) – The window to focus.

Returns

Promise – A promise which is resolved when the window has been focused.

WindowManager.getIdForBrowser(browserElement)

Retrieves an id for the given xul browser element. In case the browser is not known, an attempt is made to retrieve the id from a CPOW, and null is returned if this fails.

Arguments
  • browserElement (xul:browser) – The <xul:browser> for which we want to retrieve the id.

Returns

Number – The unique id for this browser.

WindowManager.getIdForWindow(win)

Retrieves an id for the given chrome window.

Arguments
  • win (window) – The window object for which we want to retrieve the id.

Returns

Number – The unique id for this chrome window.

WindowManager.getWindowProperties(win, options)

Returns a WindowProperties object, that can be used with GeckoDriver#setWindowHandle().

Arguments
  • win (Window) – The Chrome Window for which we want to create a properties object.

  • options (Object) –

  • options.tabIndex (Number) – Tab index of a specific Content Window in the specified Chrome Window.

Returns

WindowProperties – A window properties object.

WindowManager.openBrowserWindow(openerWindow, focus=false, isPrivate=false)

Open a new browser window.

Arguments
  • openerWindow (window) – The window from which the new window should be opened.

  • focus (Boolean) – If true, the opened window will receive the focus.

  • isPrivate (Boolean) – If true, the opened window will be a private window.

Returns

Promise – A promise resolving to the newly created chrome window.

WindowManager.updateIdForBrowser(browserElement, newId)

Forces an update for the given browser’s id.