API reference

A complete list of methods exposed by RTO_form_api.js.
Docs updated: 2025-12-17

Core

These methods exist for advanced users and for internal composition:

MethodMinimum argsWhat it does
RTOForm.detect(timeoutMs:number=1500)args: {}Checks if the extension is responding.
RTOForm.send(type, payload, opts)type, payloadLow-level request helper used by other methods.
RTOForm.command(action, payload, opts)action, payloadLow-level wrapper for DOM command actions.
RTOForm.onTabStatus(handler)handler(event)Subscribe to tabStatus events from the extension.

Tab control methods

MethodMinimum argsWhat it does
RTOForm.openTab({tabKey,url,focus?,newTab?}, opts?)tabKey, urlOpen (or reuse) a controlled tab.
RTOForm.navigate({tabKey,url,focus?}, opts?)tabKey, urlNavigate an existing controlled tab.
RTOForm.focusTab({tabKey} | tabKey, opts?)tabKeyBring the controlled tab to the front.
RTOForm.closeTab({tabKey} | tabKey, opts?)tabKeyClose the controlled tab.
RTOForm.getUrl({tabKey}, opts?)tabKeyReturn the current URL of the controlled tab.
RTOForm.listTabs(args?, opts?)(none)List currently controlled tabs.
RTOForm.adoptTab({tabId,tabKey?}, opts?)tabIdAdopt an existing browser tab into a tabKey.
RTOForm.releaseTab({tabKey} | tabKey, opts?)tabKeyRelease control of a tabKey without closing it.
RTOForm.waitForNavigation({tabKey}, opts?)tabKeyWait until navigation completes in the controlled tab.
RTOForm.screenshot({tabKey,fullPage?}, opts?)tabKeyRequest a screenshot from the controlled tab (if enabled).

DOM automation methods

Requires: load RTO_DOM_actions.js after RTO_form_api.js to add these convenience methods to RTOForm.
MethodMinimum argsWhat it does
RTOForm.click({tabKey,selector}, opts?)tabKey, selectorClick an element.
RTOForm.setValue({tabKey,selector,value}, opts?)tabKey, selector, valueSet the value of an input.
RTOForm.submit({tabKey,selector?}, opts?)tabKeySubmit a form (optionally by selector).
RTOForm.waitFor({ms}, opts?)msWait/sleep for a given number of ms (in the tab context).
RTOForm.waitForSelector({tabKey,selector}, opts?)tabKey, selectorWait until an element exists (and optionally is visible).
RTOForm.getHtml({tabKey,selector,prop?}, opts?)tabKey, selectorRead HTML/innerHTML/outerHTML.
RTOForm.setInnerHtml({tabKey,selector,html}, opts?)tabKey, selector, htmlReplace innerHTML of an element.
RTOForm.getText({tabKey,selector}, opts?)tabKey, selectorRead innerText/textContent.
RTOForm.getValue({tabKey,selector}, opts?)tabKey, selectorRead the value of an input/select.
RTOForm.getAttr({tabKey,selector,name}, opts?)tabKey, selector, nameRead an attribute.
RTOForm.setChecked({tabKey,selector,checked}, opts?)tabKey, selector, checkedCheck/uncheck a checkbox.
RTOForm.selectOption({tabKey,selector,value?}, opts?)tabKey, selectorSelect an option in a <select>.
RTOForm.selectSetValue({tabKey,selector,value}, opts?)tabKey, selector, valueSet select by value.
RTOForm.typeText({tabKey,selector,text}, opts?)tabKey, selector, textType text into an input (simulated typing).
RTOForm.pressKey({tabKey,key}, opts?)tabKey, keySimulate a key press (example: Enter).
RTOForm.focusElement({tabKey,selector}, opts?)tabKey, selectorFocus an element.
RTOForm.highlight({tabKey,selector,color?,ms?}, opts?)tabKey, selectorTemporary highlight (debug).
RTOForm.domSetStyle({tabKey,selector,style}, opts?)tabKey, selector, styleApply inline style properties.
RTOForm.injectCss({tabKey,css}, opts?)tabKey, cssInject CSS into the controlled tab.
RTOForm.addClass({tabKey,selector,className}, opts?)tabKey, selector, classNameAdd a class to an element.
RTOForm.overlayLabel({tabKey,selector,text}, opts?)tabKey, selector, textAttach a floating overlay label near an element.
RTOForm.overlayMoveTo({tabKey,selector}, opts?)tabKey, selectorMove an existing overlay to another element.
RTOForm.overlayHide({tabKey}, opts?)tabKeyHide overlay UI.
Beginner note
DOM methods usually require: allow-listed host + controlled tab + a stable selector.

Timeouts

Most failures you will see early are timeouts. Always set a reasonable timeout and use waitForSelector before reading/clicking.

// Every RTOForm method accepts an optional opts object.
// The most common field is timeoutMs.

await RTOForm.detect(1500);

await RTOForm.openTab(
  { tabKey: "demo", url: "https://example.com" },
  { timeoutMs: 20000 }
);

await RTOForm.waitForSelector(
  { tabKey: "demo", selector: "#login" },
  { timeoutMs: 8000 }
);

Next