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:
| Method | Minimum args | What it does |
|---|---|---|
RTOForm.detect(timeoutMs:number=1500) | args: {} | Checks if the extension is responding. |
RTOForm.send(type, payload, opts) | type, payload | Low-level request helper used by other methods. |
RTOForm.command(action, payload, opts) | action, payload | Low-level wrapper for DOM command actions. |
RTOForm.onTabStatus(handler) | handler(event) | Subscribe to tabStatus events from the extension. |
Tab control methods
| Method | Minimum args | What it does |
|---|---|---|
RTOForm.openTab({tabKey,url,focus?,newTab?}, opts?) | tabKey, url | Open (or reuse) a controlled tab. |
RTOForm.navigate({tabKey,url,focus?}, opts?) | tabKey, url | Navigate an existing controlled tab. |
RTOForm.focusTab({tabKey} | tabKey, opts?) | tabKey | Bring the controlled tab to the front. |
RTOForm.closeTab({tabKey} | tabKey, opts?) | tabKey | Close the controlled tab. |
RTOForm.getUrl({tabKey}, opts?) | tabKey | Return the current URL of the controlled tab. |
RTOForm.listTabs(args?, opts?) | (none) | List currently controlled tabs. |
RTOForm.adoptTab({tabId,tabKey?}, opts?) | tabId | Adopt an existing browser tab into a tabKey. |
RTOForm.releaseTab({tabKey} | tabKey, opts?) | tabKey | Release control of a tabKey without closing it. |
RTOForm.waitForNavigation({tabKey}, opts?) | tabKey | Wait until navigation completes in the controlled tab. |
RTOForm.screenshot({tabKey,fullPage?}, opts?) | tabKey | Request 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.| Method | Minimum args | What it does |
|---|---|---|
RTOForm.click({tabKey,selector}, opts?) | tabKey, selector | Click an element. |
RTOForm.setValue({tabKey,selector,value}, opts?) | tabKey, selector, value | Set the value of an input. |
RTOForm.submit({tabKey,selector?}, opts?) | tabKey | Submit a form (optionally by selector). |
RTOForm.waitFor({ms}, opts?) | ms | Wait/sleep for a given number of ms (in the tab context). |
RTOForm.waitForSelector({tabKey,selector}, opts?) | tabKey, selector | Wait until an element exists (and optionally is visible). |
RTOForm.getHtml({tabKey,selector,prop?}, opts?) | tabKey, selector | Read HTML/innerHTML/outerHTML. |
RTOForm.setInnerHtml({tabKey,selector,html}, opts?) | tabKey, selector, html | Replace innerHTML of an element. |
RTOForm.getText({tabKey,selector}, opts?) | tabKey, selector | Read innerText/textContent. |
RTOForm.getValue({tabKey,selector}, opts?) | tabKey, selector | Read the value of an input/select. |
RTOForm.getAttr({tabKey,selector,name}, opts?) | tabKey, selector, name | Read an attribute. |
RTOForm.setChecked({tabKey,selector,checked}, opts?) | tabKey, selector, checked | Check/uncheck a checkbox. |
RTOForm.selectOption({tabKey,selector,value?}, opts?) | tabKey, selector | Select an option in a <select>. |
RTOForm.selectSetValue({tabKey,selector,value}, opts?) | tabKey, selector, value | Set select by value. |
RTOForm.typeText({tabKey,selector,text}, opts?) | tabKey, selector, text | Type text into an input (simulated typing). |
RTOForm.pressKey({tabKey,key}, opts?) | tabKey, key | Simulate a key press (example: Enter). |
RTOForm.focusElement({tabKey,selector}, opts?) | tabKey, selector | Focus an element. |
RTOForm.highlight({tabKey,selector,color?,ms?}, opts?) | tabKey, selector | Temporary highlight (debug). |
RTOForm.domSetStyle({tabKey,selector,style}, opts?) | tabKey, selector, style | Apply inline style properties. |
RTOForm.injectCss({tabKey,css}, opts?) | tabKey, css | Inject CSS into the controlled tab. |
RTOForm.addClass({tabKey,selector,className}, opts?) | tabKey, selector, className | Add a class to an element. |
RTOForm.overlayLabel({tabKey,selector,text}, opts?) | tabKey, selector, text | Attach a floating overlay label near an element. |
RTOForm.overlayMoveTo({tabKey,selector}, opts?) | tabKey, selector | Move an existing overlay to another element. |
RTOForm.overlayHide({tabKey}, opts?) | tabKey | Hide 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 }
);