browserdebug

v0.1.0
io.github.CloudCorpRecords/browserdebug Checked 3 days ago Published 1 month ago

Debug web pages in Chrome: performance traces, network, console, snapshots, screenshots.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

click

Click on the provided element

ParameterTypeDescription
uid *stringThe uid of the element from a page snapshot to click
dblClickbooleanWhether to double click the element

drag

Drag an element onto another element

ParameterTypeDescription
from_uid *stringThe uid of the element to drag from
to_uid *stringThe uid of the element to drag onto

fill

Type text into an input, text area or select an option from a select element

ParameterTypeDescription
uid *stringThe uid of the input, text area, or select element to fill
value *stringThe text to type into the element, or the value of the option to select

fill_form

Fill out multiple form elements at once

ParameterTypeDescription
elements *arrayThe form elements to fill, each given as an element uid and the value to enter

handle_dialog

Handle a browser dialog (accept or dismiss)

ParameterTypeDescription
action *stringThe dialog action to take: accept or dismiss
promptTextstringOptional text to enter into a prompt dialog before accepting it

hover

Hover over the provided element

ParameterTypeDescription
uid *stringThe uid of the element from a page snapshot to hover over

press_key

Press a key or key combination in the browser

ParameterTypeDescription
key *stringThe key or key combination to press, such as Enter or Control+A

upload_file

Upload a file through a file input element

ParameterTypeDescription
filePath *stringThe local path of the file to upload
uid *stringThe uid of the file input element to upload through

close_page

Closes the page by its index; the last open page cannot be closed

ParameterTypeDescription
pageId *numberThe index of the page to close, as listed by list_pages

list_pages

Get a list of pages open in the browser

navigate_page

Navigate the currently selected page to a URL, or back, forward or reload

ParameterTypeDescription
ignoreCachebooleanWhether to ignore the browser cache when reloading the page
timeoutnumberOptional navigation timeout in milliseconds
typestringOptional navigation type: url, back, forward, or reload
urlstringThe URL to navigate to when the navigation type is url

new_page

Open a new tab and load a URL

ParameterTypeDescription
url *stringThe URL to load in the new tab
backgroundbooleanWhether to open the new tab in the background without selecting it
timeoutnumberOptional navigation timeout in milliseconds

select_page

Select a page as the context for future tool calls

ParameterTypeDescription
pageId *numberThe index of the page to select, as listed by list_pages
bringToFrontbooleanWhether to bring the selected page to the front

wait_for

Wait until any of the provided texts appears on the selected page

ParameterTypeDescription
text *arrayThe texts to wait for; the call returns when any one of them appears on the page
timeoutnumberOptional timeout in milliseconds to wait for the text

emulate

Emulates network, CPU, geolocation, user agent and colour scheme features on the selected page

ParameterTypeDescription
colorSchemestringOptional colour scheme to emulate: light, dark, or auto
cpuThrottlingRatenumberOptional CPU throttling rate; 1 means no throttling and the value must be at least 1
geolocationstringOptional geolocation to emulate, given as a latitude and longitude pair
networkConditionsstringOptional network conditions preset to emulate, such as Slow 3G or Fast 3G
userAgentstringOptional user agent string to emulate

resize_page

Resizes the selected page's window so the page fits the given dimensions

ParameterTypeDescription
height *numberThe new window height in pixels
width *numberThe new window width in pixels

performance_analyze_insight

Provide more detailed information on a specific performance insight from a recorded trace

ParameterTypeDescription
insightName *stringThe name of the performance insight to analyse
insightSetId *stringThe id of the insight set from a recorded performance trace

performance_start_trace

Start a performance trace on the selected page

ParameterTypeDescription
autoStopbooleanWhether to stop the trace automatically once the page has loaded
filePathstringOptional file path to save the trace to when it stops
reloadbooleanWhether to reload the page after starting the trace

performance_stop_trace

Stop the active performance trace

ParameterTypeDescription
filePathstringOptional file path to save the stopped trace to

get_network_request

Get a network request by its request id; without an id, the currently selected request in DevTools

ParameterTypeDescription
reqidnumberOptional request id of the network request; the request currently selected in DevTools is used when omitted

list_network_requests

List all requests for the currently selected page since navigation

ParameterTypeDescription
includePreservedRequestsbooleanWhether to include requests preserved from the previous navigation
pageIdxnumberOptional page index of the request list to return
pageSizenumberOptional maximum number of requests to return in one page of results
resourceTypesarrayOptional list of resource types to filter the requests by

evaluate_script

Evaluate a JavaScript function inside the currently selected page and return its result

ParameterTypeDescription
function *stringThe JavaScript function declaration to evaluate inside the selected page
argsarrayOptional element uids to pass to the function as its arguments

get_console_message

Get a console message by its id

ParameterTypeDescription
msgid *numberThe id of the console message, as listed by list_console_messages

list_console_messages

List all console messages for the currently selected page since navigation

ParameterTypeDescription
includePreservedMessagesbooleanWhether to include messages preserved from the previous navigation
pageIdxnumberOptional page index of the message list to return
pageSizenumberOptional maximum number of messages to return in one page of results
typesarrayOptional list of console message types to filter by, such as log, error, or warning

take_screenshot

Take a screenshot of the page or an element

ParameterTypeDescription
filePathstringOptional file path to save the screenshot to
formatstringOptional image format of the screenshot: png, jpeg, or webp
fullPagebooleanWhether to capture the full page instead of the visible viewport
qualitynumberOptional image quality from 0 to 100, for the jpeg and webp formats
uidstringOptional uid of an element to screenshot instead of the page

take_snapshot

Take a text snapshot of the currently selected page based on the accessibility tree

ParameterTypeDescription
filePathstringOptional file path to save the snapshot to
verbosebooleanWhether to include verbose accessibility tree details in the snapshot