Documentation ¶
Overview ¶
package chrome provides helper functions to execute JS in a Chrome browser
This would ordinarily be done via a Chrome struct but Go does not allow generic methods, only generic static functions, producing "method must have no type parameters".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustRunAsyncFn ¶
MustRunAsyncFn is RunAsyncFn but fails the test if an error is returned when executing.
Run an anonymous async iffe in the browser. Set the type parameter to a basic data type which can be returned as JSON e.g string, map[string]any, []string. If you do not want to return anything, use chrome.Void
func RunAsyncFn ¶
Run an anonymous async iffe in the browser. Set the type parameter to a basic data type which can be returned as JSON e.g string, map[string]any, []string. If you do not want to return anything, use chrome.Void. For example:
result, err := RunAsyncFn[string](t, ctx, "return await getSomeString()") void, err := RunAsyncFn[chrome.Void](t, ctx, "doSomething(); await doSomethingElse();")
Types ¶
type Void ¶
type Void *runtime.RemoteObject
Void is a type which can be used when you want to run an async function without returning anything. It can stop large responses causing errors "Object reference chain is too long (-32000)" when we don't care about the response.