browser module

Context

class Marionette.Context()

Variations of Marionette contexts.

Choosing a context through the <tt>Marionette:SetContext</tt> command directs all subsequent browsing context scoped commands to that context.

browser.Context

class browser.Context(win, driver)

Creates a browsing context wrapper.

Browsing contexts handle interactions with the browser, according to the current environment.

Arguments
  • win (ChromeWindow) – ChromeWindow that contains the top-level browsing context.

  • driver (GeckoDriver) – Reference to driver instance.

browser.Context.closeTab()

Close the current tab.

Throws

UnsupportedOperationError If tab handling for the current application isn’t supported.

Returns

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

browser.Context.closeWindow()

Close the current window.

Returns

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

browser.Context.closed

Checks if the browsing context has been discarded.

The browsing context will have been discarded if the content browser, represented by the <code>&lt;xul:browser&gt;</code>, has been detached.

browser.Context.contentBrowser

Returns the content browser for the currently selected tab. If there is no tab selected, null will be returned.

browser.Context.focusWindow()

Focus the current window.

Returns

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

browser.Context.getTabModal()

Retrieves the current tabmodal UI object. According to the browser associated with the currently selected tab.

browser.Context.openBrowserWindow(focus, isPrivate)

Open a new browser window.

Returns

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

browser.Context.openTab(focus)

Open a new tab in the currently selected chrome window.

browser.Context.rect

Gets the position and dimensions of the top-level browsing context.

browser.Context.register(target)

Registers a new frame, and sets its current frame id to this frame if it is not already assigned, and if a) we already have a session or b) we’re starting a new session and it is the right start frame.

Arguments
  • target (xul:browser) – The <xul:browser> that was the target of the originating message.

browser.Context.switchToTab(index, window, focus=true)

Set the current tab.

Arguments
  • index (number) – Tab index to switch to. If the parameter is undefined, the currently selected tab will be used.

  • window (ChromeWindow) – Switch to this window before selecting the tab.

  • focus (boolean) – A boolean value which determins whether to focus the window. Defaults to true.

Throws

UnsupportedOperationError If tab handling for the current application isn’t supported.

Returns

Tab – The selected tab.

browser.getBrowserForTab

browser.getBrowserForTab(tab)

Get the <code>&lt;xul:browser&gt;</code> for the specified tab.

Arguments
  • tab (Tab) – The tab whose browser needs to be returned.

Returns

Browser – The linked browser for the tab or null if no browser can be found.

browser.getTabBrowser

browser.getTabBrowser(win)

Return the tab browser for the specified chrome window.

Arguments
  • win (ChromeWindow) – Window whose <code>tabbrowser</code> needs to be accessed.

Returns

Tab – Tab browser or null if it’s not a browser window.