Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:MarketSquare Robotframework browser Browser Control Grpc Handlers

From Leeroopedia
Revision as of 11:29, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/MarketSquare_Robotframework_browser_Browser_Control_Grpc_Handlers.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Browser Automation, gRPC Services
Last Updated 2026-02-12 05:40 GMT

Overview

Browser-level gRPC service handlers for navigation, screenshots, permissions, viewport configuration, offline mode, page reload, and geolocation operations in the Playwright wrapper layer.

Description

This module exports a set of async functions that serve as gRPC request handlers for browser control operations. Each function receives a typed protobuf Request message and either a Page, BrowserContext, or PlaywrightState object, performs the corresponding Playwright API call, and returns a protobuf Response message.

goTo navigates to a URL with optional timeout and waitUntil parameters. takeScreenshot captures a page or element screenshot with support for mask locators that hide specified elements. setTimeout sets the default timeout on the active browser context. setViewportSize adjusts the page viewport dimensions. setOffline toggles the context's network offline mode. reload reloads the current page with configurable options. setGeolocation sets the geolocation for the browser context. grantPermissions and clearPermissions manage browser permission grants on the active context. executePlaywright invokes arbitrary Playwright CLI commands by parsing JSON arguments.

Usage

These handlers are invoked by the gRPC server when the Python-side Browser library sends corresponding keyword requests over the wire. They are not called directly by end users but are the Node.js-side implementation behind Robot Framework keywords such as Go To, Take Screenshot, Set Browser Timeout, Set Viewport Size, Set Offline, Reload, Set Geolocation, Grant Permissions, and Clear Permissions.

Code Reference

Source Location

Signature

export async function executePlaywright(request: Request.Json): Promise<Response.Empty>

export async function grantPermissions(request: Request.Permissions, state: PlaywrightState): Promise<Response.Empty>

export async function clearPermissions(request: Request.Empty, state: PlaywrightState): Promise<Response.Empty>

export async function goTo(request: Request.UrlOptions, page: Page): Promise<Response.Empty>

export async function takeScreenshot(request: Request.ScreenshotOptions, state: PlaywrightState): Promise<Response.String>

export async function setTimeout(request: Request.Timeout, context?: BrowserContext): Promise<Response.Empty>

export async function setViewportSize(request: Request.Viewport, page: Page): Promise<Response.Empty>

export async function setOffline(request: Request.Bool, context?: BrowserContext): Promise<Response.Empty>

export async function reload(page: Page, body: string): Promise<Response.Empty>

export async function setGeolocation(request: Request.Json, context?: BrowserContext): Promise<Response.Empty>

Import

import {
    goTo, takeScreenshot, setTimeout, setViewportSize,
    setOffline, reload, setGeolocation, grantPermissions,
    clearPermissions, executePlaywright
} from './browser-control';

I/O Contract

Function Request Type Response Type Description
goTo Request.UrlOptions Response.Empty (with status string) Navigates page to URL; returns HTTP status code as string response
takeScreenshot Request.ScreenshotOptions Response.String Captures screenshot to file path; supports element selector and mask locators
setTimeout Request.Timeout Response.Empty Sets default timeout on the active BrowserContext
setViewportSize Request.Viewport Response.Empty Sets page viewport width and height
setOffline Request.Bool Response.Empty Toggles network offline mode on the context
reload Page, body: string (JSON) Response.Empty Reloads the current page with parsed JSON options
setGeolocation Request.Json Response.Empty Sets geolocation on the browser context from JSON body
grantPermissions Request.Permissions Response.Empty Grants specified permissions with optional origin restriction
clearPermissions Request.Empty Response.Empty Clears all granted permissions on the active context
executePlaywright Request.Json Response.Empty Executes a Playwright CLI command from JSON args

Usage Examples

*** Settings ***
Library    Browser

*** Test Cases ***
Navigation And Screenshot Example
    New Browser    chromium    headless=true
    New Page       https://example.com
    Go To          https://example.com/page
    Take Screenshot    fullPage=true
    Set Viewport Size    width=1920    height=1080
    Reload
    Set Offline    true

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment