Skip to main content
Browser

Get an iframe

Get an iframe

Finds an iframe on the browser's page by CSS selector and returns it as a browsing context of its own, so you can work with the elements inside it as if it were an ordinary page.

Careful

An iframe from a different domain may be restricted by the site's security policies. In that case the action can fail even though the iframe is on the page.


Options

Browser or page ID

The browser, tab or iframe opening action the iframe is in.

Element selector

The CSS selector identifying the iframe on the page, iframe#mainFrame for example.

Returns

Javascript code

js
actions["action-id"]._page // the iframe's inner browsing context (Session)
actions["action-id"]._browser // the browser instance (Session)

Field selection

This action's output is available in the Browser or page ID field of the browser actions that follow, so you can work with the elements inside the iframe as if it were an ordinary page.

Rules and conditions

  • Browser or page ID and Element selector are both required.
  • The selector has to point at an iframe element on the page.
  • If the iframe is not found, the action ends in an error.