changed browser api to return pages that can be acted on, not strictly contents

This commit is contained in:
2024-12-17 23:16:13 -05:00
parent 23334991b1
commit 5e924eb3f9
5 changed files with 154 additions and 93 deletions

View File

@@ -5,23 +5,8 @@ import (
"io"
)
type ScreenshotStyle string
const (
ScreenshotStyleFullPage ScreenshotStyle = "full"
ScreenshotStyleViewport ScreenshotStyle = "viewport"
)
type ScreenshotOptions struct {
Style ScreenshotStyle
Width int
Height int
}
type Browser interface {
io.Closer
Open(ctx context.Context, url string) (Source, error)
Screenshot(ctx context.Context, url string, opts ScreenshotOptions) ([]byte, error)
OpenAndScreenshot(ctx context.Context, url string, opts ScreenshotOptions) (Source, []byte, error)
Open(ctx context.Context, url string) (Document, error)
}