Class: Context

browser.Context(win, driver)

Creates a browsing context wrapper.

Browsing contexts handle interactions with the browser, according to the current environment (Firefox, Fennec).

Constructor

new Context(win, driver)

Parameters:
Name Type Description
win ChromeWindow

ChromeWindow that contains the top-level browsing context.

driver GeckoDriver

Reference to driver instance.

Source:

Members

contentBrowser

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

Source:

curFrameId

The current frame ID is managed per browser element on desktop in case the ID needs to be refreshed. The currently selected window is identified by a tab.

Source:

currentTitle

Returns the current title of the content browser.

Source:

currentURI

Returns the current URI of the content browser.

Source:

rect

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

Source:

Methods

addTab(uri)

Opens a tab with given URI.

Parameters:
Name Type Description
uri string

URI to open.

Source:

closeTab() → {Promise}

Close the current tab.

Source:
Throws:

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

Returns:

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

Type
Promise

closeWindow() → {Promise}

Close the current window.

Source:
Returns:

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

Type
Promise

executeWhenReady()

This function intercepts commands interacting with content and queues or executes them as needed.

No commands interacting with content are safe to process until the new listener script is loaded and registers itself. This occurs when a command whose effect is asynchronous (such as goBack) results in a reload of the frame script and new commands are subsequently posted to the server.

Source:

flushPendingCommands()

Flushes any queued pending commands after a reload of the frame script.

Source:

getTabModalUI()

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

Source:

register(uid, 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.

Parameters:
Name Type Description
uid string

Frame uid for use by Marionette.

target xul:browser

The that was the target of the originating message.

Source:

switchToTab(indexopt, windowopt, focusopt)

Set the current tab.

Parameters:
Name Type Attributes Default Description
index number <optional>

Tab index to switch to. If the parameter is undefined, the currently selected tab will be used.

window ChromeWindow <optional>

Switch to this window before selecting the tab.

focus boolean <optional>
true

A boolean value which determins whether to focus the window. Defaults to true.

Source:
Throws:

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