Browser
Open web pages, dashboards, video calls and kiosk screens in browser windows on the monitors of the computer ARCx runs on, and control them: move them between monitors, go full screen, run JavaScript inside the page, and pass messages between the page and your script. Each window has a name you choose, so a script can open several and control each one.
Where to find it: type Browser. in a Python script, or open the ARCx API view of the script editor and expand Browser
Commands
| Command | What it does |
|---|---|
| Browser.Back | Goes back one page in the window called "Browser", like the back button. |
| Browser.ClearMessages | Forget unread messages from the page, so the next waitForMessage only sees new ones |
| Browser.Close | Close the window called "Browser". |
| Browser.CloseAll | Closes every open browser window, including kiosk windows and ones opened by robot skills. |
| Browser.Evaluate | Run a JavaScript expression in the page of the window called "Browser" and return its value |
| Browser.ExecuteScript | Run JavaScript in the page without waiting for it |
| Browser.Focus | Brings a named window to the front and gives it the keyboard. |
| Browser.Forward | Goes forward one page in the window called "Browser", like the forward button. |
| Browser.GetLastMessage | The data of the last message the page sent with this topic, or "" |
| Browser.GetMonitorCount | The number of monitors attached to this computer. |
| Browser.GetMonitors | One line per monitor: "0: \.\DISPLAY1 1920x1080 at 0,0 (primary)" |
| Browser.GetStatus | A sentence saying whether browser windows work here, and if not, why |
| Browser.GetTitle | The title of the page in the window called "Browser", or empty text when the window is not open. |
| Browser.GetUrl | The address showing now, or "" when the window is not open |
| Browser.GetWindowNames | The names of all open browser windows, oldest first. |
| Browser.Hide | Hides a named window without closing it, so it can be shown again. |
| Browser.Home | Go back to the page the window was opened with |
| Browser.IsAvailable | True when browser windows can be opened on this computer |
| Browser.IsLoading | Whether the page in a named window is still loading. |
| Browser.IsOpen | Whether the window called "Browser" is open. |
| Browser.MoveToMonitor | Move the window to a monitor by its number in getMonitors(). |
| Browser.Navigate | Load a page in the window called "Browser" |
| Browser.Open | Open a page in the window called "Browser", or show it there if the window is already open |
| Browser.OpenCustomUI | Show the project's custom UI as a kiosk on the primary monitor, in the window called "Custom UI" |
| Browser.OpenFullscreen | Opens a page full screen on the primary monitor in a named window, or re-points that window if it is already open. |
| Browser.OpenKiosk | Fullscreen, always on top, no shortcuts or menus, retries when offline and reopens if closed |
| Browser.OpenWithOptions | Open with any window option, as JSON: '{"DisplayMode":"Kiosk","AllowCamera":true,"AllowMicrophone":true,"HideCursor":true}' |
| Browser.Reload | Loads the page in the window called "Browser" again. |
| Browser.SaveScreenshot | Save a PNG of the window in the robot pictures folder. |
| Browser.SendMessage | Send a message to the page's window.ARCx.on(topic, handler). |
| Browser.SetAlwaysOnTop | Keeps a named window above other windows, or lets other windows cover it again. |
| Browser.SetBounds | Windowed position (relative to its monitor) and size, in pixels |
| Browser.SetDisplayMode | "Windowed", "Fullscreen" or "Kiosk" |
| Browser.SetFullscreen | Switches a named window between full screen and windowed. |
| Browser.SetMediaPermissions | Let the page use the camera and microphone (for video calls). |
| Browser.SetMuted | Mutes or unmutes the sound of the page in a named window. |
| Browser.SetZoom | Page zoom in percent, 25 to 500 |
| Browser.Show | Shows a named window again after it was hidden. |
| Browser.ShowDevTools | Opens the Chromium developer tools for the page in a named window, to find problems in the page. |
| Browser.Stop | Stops the page in a named window from loading any further. |
| Browser.WaitForLoad | Wait for the page to finish loading. |
| Browser.WaitForMessage | Return the data of the oldest unread window.ARCx.send(topic, data) from the page, waiting for one if needed. |
Details
Browser.Back
Goes back one page in the window called "Browser", like the back button. Raises an error when the window is not open.
Browser.Back()
Browser.Back(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Browser.ClearMessages
Forget unread messages from the page, so the next waitForMessage only sees new ones
Browser.ClearMessages(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
Browser.Close
Close the window called "Browser". False when it was not open
Browser.Close()
Browser.Close(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Gives back: bool. Whether the window was open and is now closed.
Browser.CloseAll
Closes every open browser window, including kiosk windows and ones opened by robot skills.
Browser.CloseAll()
Browser.Evaluate
Run a JavaScript expression in the page of the window called "Browser" and return its value
Browser.Evaluate(script)
Browser.Evaluate(windowName, script)
Browser.Evaluate(windowName, script, timeoutMs)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Only in some forms. The name of the window, such as "Browser". |
script |
str | The JavaScript expression to evaluate in the page, such as document.title. |
timeoutMs |
int | Only in some forms. How long to wait in milliseconds. 0 or less uses 10 seconds. |
Browser.Evaluate(script): Run a JavaScript expression in the page of the window called "Browser" and return its valueBrowser.Evaluate(windowName, script): Run a JavaScript expression in the page and return its value. Promises are awaitedBrowser.Evaluate(windowName, script, timeoutMs): Runs a JavaScript expression in the page of a named window and returns its value, waiting up to a time limit. Promises are awaited, and an error in the page or a timeout raises an error.
Gives back: str. The value as text: a string as it is, anything else as JSON, and empty text for null or undefined.
Browser.ExecuteScript
Run JavaScript in the page without waiting for it
Browser.ExecuteScript(windowName, script)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
script |
str | The JavaScript code to run in the page. |
Browser.Focus
Brings a named window to the front and gives it the keyboard. Raises an error when the window is not open.
Browser.Focus(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
Browser.Forward
Goes forward one page in the window called "Browser", like the forward button. Raises an error when the window is not open.
Browser.Forward()
Browser.Forward(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Browser.GetLastMessage
The data of the last message the page sent with this topic, or ""
Browser.GetLastMessage(windowName, topic)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
topic |
str | The topic to look for, or empty text for any topic. |
Gives back: str. The message data as text, or empty text when there is none or the window is not open.
Browser.GetMonitorCount
The number of monitors attached to this computer. Starts the browser helper if it is not running, which can take a few seconds, and raises an error when browser windows are not available here.
Browser.GetMonitorCount()
Gives back: int. The number of monitors.
Browser.GetMonitors
One line per monitor: "0: \.\DISPLAY1 1920x1080 at 0,0 (primary)"
Browser.GetMonitors()
Gives back: list[str]. One description line per monitor, numbered from 0.
Browser.GetStatus
A sentence saying whether browser windows work here, and if not, why
Browser.GetStatus()
Gives back: str. A short status sentence, such as that Chromium is running, or the reason browser windows are off.
Browser.GetTitle
The title of the page in the window called "Browser", or empty text when the window is not open.
Browser.GetTitle()
Browser.GetTitle(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Gives back: str. The page title, or empty text when the window is not open.
Browser.GetUrl
The address showing now, or "" when the window is not open
Browser.GetUrl()
Browser.GetUrl(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Gives back: str. The address, or empty text when the window is not open.
Browser.GetWindowNames
The names of all open browser windows, oldest first.
Browser.GetWindowNames()
Gives back: list[str]. The window names, or an empty list when none are open.
Browser.Hide
Hides a named window without closing it, so it can be shown again. Raises an error when the window is not open.
Browser.Hide(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
Browser.Home
Go back to the page the window was opened with
Browser.Home()
Browser.Home(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Browser.IsAvailable
True when browser windows can be opened on this computer
Browser.IsAvailable()
Gives back: bool. Whether browser windows can be opened.
Browser.IsLoading
Whether the page in a named window is still loading. A window that is not open counts as not loading.
Browser.IsLoading(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
Gives back: bool. Whether the page is still loading.
Browser.IsOpen
Whether the window called "Browser" is open.
Browser.IsOpen()
Browser.IsOpen(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Gives back: bool. Whether the window is open.
Browser.MoveToMonitor
Move the window to a monitor by its number in getMonitors(). -1 is the primary monitor
Browser.MoveToMonitor(windowName, monitor)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
monitor |
int | The monitor number, counting from 0, or -1 for the primary monitor. |
Browser.Navigate
Load a page in the window called "Browser"
Browser.Navigate(url)
Browser.Navigate(windowName, url)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Only in some forms. The name of the window, such as "Browser". |
url |
str | The address to show, such as https://example.com. A file path opens that file. |
Browser.Navigate(url): Load a page in the window called "Browser"Browser.Navigate(windowName, url): Loads a page in a named window without waiting for it to finish. Raises an error when the window is not open.
Browser.Open
Open a page in the window called "Browser", or show it there if the window is already open
Browser.Open(url)
Browser.Open(windowName, url)
Browser.Open(windowName, url, mode)
Browser.Open(windowName, url, mode, monitor)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Only in some forms. The name of the window, such as "Browser". |
url |
str | The address to show, such as https://example.com. A file path opens that file. |
mode |
str | Only in some forms. "Windowed", "Fullscreen" or "Kiosk". Anything else raises an error. |
monitor |
int | Only in some forms. The monitor number, counting from 0, or -1 for the primary monitor. |
Browser.Open(url): Open a page in the window called "Browser", or show it there if the window is already openBrowser.Open(windowName, url): Open a page in a named window, or show it there if that window is already openBrowser.Open(windowName, url, mode): mode is "Windowed", "Fullscreen" or "Kiosk"Browser.Open(windowName, url, mode, monitor): Opens a page in a named window in the given mode on a monitor, or re-points that window if it is already open. Waits until the window exists, not until the page has loaded.
Browser.OpenCustomUI
Show the project's custom UI as a kiosk on the primary monitor, in the window called "Custom UI"
Browser.OpenCustomUI()
Browser.OpenCustomUI(screenTitle)
Browser.OpenCustomUI(screenTitle, monitor)
| Value | Type | What it is |
|---|---|---|
screenTitle |
str | Optional. The title of the custom UI screen to show, or empty text for the screen showing now. |
monitor |
int | Optional. The monitor number, counting from 0, or -1 for the primary monitor. |
Browser.OpenFullscreen
Opens a page full screen on the primary monitor in a named window, or re-points that window if it is already open.
Browser.OpenFullscreen(windowName, url)
Browser.OpenFullscreen(windowName, url, monitor)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
url |
str | The address to show, such as https://example.com. A file path opens that file. |
monitor |
int | Optional. The monitor number, counting from 0, or -1 for the primary monitor. |
Browser.OpenKiosk
Fullscreen, always on top, no shortcuts or menus, retries when offline and reopens if closed
Browser.OpenKiosk(windowName, url)
Browser.OpenKiosk(windowName, url, monitor)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
url |
str | The address to show, such as https://example.com. A file path opens that file. |
monitor |
int | Optional. The monitor number, counting from 0, or -1 for the primary monitor. |
Browser.OpenWithOptions
Open with any window option, as JSON: '{"DisplayMode":"Kiosk","AllowCamera":true,"AllowMicrophone":true,"HideCursor":true}'
Browser.OpenWithOptions(windowName, url, optionsJson)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
url |
str | The address to show, such as https://example.com. A file path opens that file. |
optionsJson |
str | The window options as JSON text. Empty text uses the defaults, and JSON that is not valid raises an error. |
Browser.Reload
Loads the page in the window called "Browser" again. Raises an error when the window is not open.
Browser.Reload()
Browser.Reload(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
Browser.SaveScreenshot
Save a PNG of the window in the robot pictures folder. Returns where it was saved
Browser.SaveScreenshot(windowName)
Browser.SaveScreenshot(windowName, fileName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
fileName |
str | Optional. The file name or full path. Empty text picks a name from the window name and the time. |
Gives back: str. The full path of the saved PNG file.
Browser.SendMessage
Send a message to the page's window.ARCx.on(topic, handler). data can be text, a number or an object
Browser.SendMessage(windowName, topic)
Browser.SendMessage(windowName, topic, data)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
topic |
str | The topic the page listens for. |
data |
object | Optional. The data to send: text, a number, a dict or a list. Text that holds JSON arrives as that object. |
Browser.SetAlwaysOnTop
Keeps a named window above other windows, or lets other windows cover it again. Raises an error when the window is not open.
Browser.SetAlwaysOnTop(windowName, alwaysOnTop)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
alwaysOnTop |
bool | Whether the window stays on top. |
Browser.SetBounds
Windowed position (relative to its monitor) and size, in pixels
Browser.SetBounds(windowName, x, y, width, height)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
x |
int | Left edge in pixels, from the left of the monitor. |
y |
int | Top edge in pixels, from the top of the monitor. |
width |
int | Width in pixels. |
height |
int | Height in pixels. |
Browser.SetDisplayMode
"Windowed", "Fullscreen" or "Kiosk"
Browser.SetDisplayMode(windowName, mode)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
mode |
str | "Windowed", "Fullscreen" or "Kiosk". Anything else raises an error. |
Browser.SetFullscreen
Switches a named window between full screen and windowed. A kiosk window stays a kiosk either way. Raises an error when the window is not open.
Browser.SetFullscreen(windowName, fullscreen)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
fullscreen |
bool | Whether to show the window full screen. |
Browser.SetMediaPermissions
Let the page use the camera and microphone (for video calls). There is no prompt
Browser.SetMediaPermissions(windowName, allowCamera, allowMicrophone)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
allowCamera |
bool | Whether the page may use the camera. |
allowMicrophone |
bool | Whether the page may use the microphone. |
Browser.SetMuted
Mutes or unmutes the sound of the page in a named window. Raises an error when the window is not open.
Browser.SetMuted(windowName, muted)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
muted |
bool | Whether to mute the page. |
Browser.SetZoom
Page zoom in percent, 25 to 500
Browser.SetZoom(windowName, percent)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
percent |
int | The zoom, where 100 is normal size. Values outside 25 to 500 are kept within that range. |
Browser.Show
Shows a named window again after it was hidden. Raises an error when the window is not open.
Browser.Show(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
Browser.ShowDevTools
Opens the Chromium developer tools for the page in a named window, to find problems in the page. Raises an error for a kiosk window or a window that is not open.
Browser.ShowDevTools(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
Browser.Stop
Stops the page in a named window from loading any further. Raises an error when the window is not open.
Browser.Stop(windowName)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
Browser.WaitForLoad
Wait for the page to finish loading. True when it loaded, false when it failed or timed out (30 seconds)
Browser.WaitForLoad()
Browser.WaitForLoad(windowName)
Browser.WaitForLoad(windowName, timeoutMs)
| Value | Type | What it is |
|---|---|---|
windowName |
str | Optional. The name of the window, such as "Browser". |
timeoutMs |
int | Optional. How long to wait in milliseconds. 0 or less waits with no time limit. |
Gives back: bool. Whether the page loaded. A failed load, a timeout or a window that is not open count as not loaded.
Browser.WaitForMessage
Return the data of the oldest unread window.ARCx.send(topic, data) from the page, waiting for one if needed. "" on timeout. An empty topic accepts any
Browser.WaitForMessage(windowName, topic)
Browser.WaitForMessage(windowName, topic, timeoutMs)
| Value | Type | What it is |
|---|---|---|
windowName |
str | The name of the window, such as "Browser". |
topic |
str | The topic to wait for, or empty text for any topic. |
timeoutMs |
int | Optional. How long to wait in milliseconds. 0 or less waits with no time limit. |
Gives back: str. The data the page sent, as text. Waits with no time limit, and gives empty text if the window closes first.