structeval

command
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Command structeval is a chromedp example demonstrating how to evaluate JavaScript into typed Go values. The type parameter of chromedp.Evaluate decides how the result is read. The program loads a local page that holds a JavaScript object with nested data, and it reads parts of the object as a struct, a slice of structs, a map, a number, a decimal number and a boolean. It shows the Go errors for a JavaScript exception, for a result of undefined or null, and for a result of the wrong type. It also shows how to wait for a promise with an option for Evaluate. It starts a local server and needs no internet. Use -v to print the protocol messages, -visible to show the browser window and leave it open, and -visible-on-terminal to draw the page in the terminal with terminal graphics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL