Block reference / Web interaction

Switch frame

Run the blocks that follow inside an iframe, or go back to the main page.

Only inWarpX Browser

Parts of many pages live in iframes: card payment fields, captchas, embedded sign-in forms, chat widgets. Switch frame makes every block after it look for elements inside one iframe, including one from another site. Switch back with Main window when you are done.

The Switch frame block's settings, filled in as in the example below.

Settings

Main window / Iframe

The unlabelled list at the top. Iframe runs the following blocks inside the frame you name below. Main window goes back to the page itself.

ExampleIframe
Element selectorwhen Iframe is chosen

The <iframe> or <frame> to switch into, as a CSS selector or XPath, looked for from the top of the page. For a frame inside a frame, name each one in turn joined by |>, such as iframe#checkout |> iframe[name="card"]. The target button and the double tick work as in other blocks.

Exampleiframe[title="Secure card payment input frame"]

Every block also has the shared block settings — a description, Disable block and what to do on an error, and Finding elements explains selectors in more depth. Fields that take text accept data from earlier blocks.

What it hands on

Writes nothing to the table or variables, and leaves by its single output. After it, every block runs inside the frame until another Switch frame chooses Main window, or the run moves to another page or tab with Open URL, New tab, Switch tab or Link with Open in new tab. If nothing matches, the block fails with element-not-found, and if the match is not an iframe it fails with not-iframe. Either way the run stays in the frame it was in.

Example: Type a card number into an embedded payment form

  1. Start
  2. Open URL
  3. Switch frame
  4. Type text
  5. Switch frame
  6. Click element
Where Switch frame sits in the example workflow.
  1. Add Open URL after Start with https://shop.example.com/checkout.
  2. Add Switch frame, choose Iframe, and set Element selector to iframe[title="Secure card payment input frame"].
  3. Add Type text with input[name="cardnumber"] and the text 4242 4242 4242 4242. It runs inside the frame.
  4. Add a second Switch frame and choose Main window.
  5. Add Click element with button#place-order.
  6. Run the workflow. The card number goes into the payment frame, and the order button on the page itself is clicked.

Good to know

  • Frames from other sites work. WarpX Browser reaches the frame by its selector, so payment, captcha and sign-in frames can be switched into.
  • The block does not wait for the iframe. On a slow page, check for it first with Element exists.
  • A switch replaces the current frame rather than going deeper, and the selector is always read from the top of the page. To reach a nested frame, name the whole chain in one selector with |>.
  • A block whose own selector already names its frames with |>, as the target button writes when you click inside a frame, is looked up from the top of the page and ignores the switched frame. With picked selectors you often do not need Switch frame at all.
  • Main window checks nothing and always succeeds.

See also

  • Type text — Put text into an input, textarea or editable element.
  • Click element — Click an element on the page, with human-like mouse movement by default.
  • Element exists — Check whether an element is on the page and continue by one of two outputs.
  • Switch tab — Move the run to another open tab, found by its address, its title or its position.