Documentation ¶
Index ¶
- Constants
- Variables
- func AllowBrowserAutomation()
- func DisallowBrowserAutomation()
- func DownloadBrowser(ctx context.Context, logger zerolog.Logger) (execPath string, finalErr error)
- func HostGoogle(revision int) string
- func HostNPM(revision int) string
- func HostPlaywright(revision int) string
- func IsBrowserAutomationAllowed() bool
- func LookPath() (found string, has bool)
- func NewChromeNamespace() *core.Namespace
- func SetBrowserBinPath(val string)
- func SetBrowserBinPathToInstalledOrCachedBrowser() bool
- func StartSharedProxy(ctx *core.Context) error
- func Validate(binpath string) error
- type Handle
- func (h *Handle) Click(ctx *core.Context, s core.String) error
- func (h *Handle) Close(ctx *core.Context)
- func (h *Handle) Equal(ctc *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, ...) bool
- func (h *Handle) GetGoMethod(name string) (*core.GoFunction, bool)
- func (h *Handle) HtmlNode(ctx *core.Context, sel core.String) (*html_ns.HTMLNode, error)
- func (h *Handle) IsMutable() bool
- func (h *Handle) Nav(ctx *core.Context, u core.URL) error
- func (h *Handle) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, ...)
- func (h *Handle) Prop(ctx *core.Context, name string) core.Value
- func (h *Handle) PropertyNames(ctx *core.Context) []string
- func (h *Handle) Screenshot(ctx *core.Context, sel core.String) (*core.ByteSlice, error)
- func (h *Handle) ScreenshotPage(ctx *core.Context) (*core.ByteSlice, error)
- func (*Handle) SetProp(ctx *core.Context, name string, value core.Value) error
- func (h *Handle) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)
- func (h *Handle) WaitVisible(ctx *core.Context, s core.String) error
Constants ¶
View Source
const ( // RevisionDefault for chromium RevisionDefault = 1131657 // RevisionPlaywright for arm linux RevisionPlaywright = 1080 )
View Source
const ( DEFAULT_SINGLE_ACTION_TIMEOUT = 15 * time.Second LOG_SRC = "chrome" )
View Source
const ( BROWSER_PROXY_PORT = 12750 BROWSER_PROXY_ADDR = "127.0.0.1:12750" //After a browser instance is created it navigates to this URL. //The request is intercepted by the proxy, no server is listening on this port. //The hostname should not be changed because using the loopback allows to check that //requests to the loopback do not bypass the proxy. CHROME_INSTANCE_REGISTRATION_URL_PREFIX = "https://127.0.0.1:9999/register-browser-instance/" BROWSER_PROXY_SRC_NAME = "/browser-proxy" )
View Source
const (
HANDLE_ID_HEADER = "X-Browser-Handle"
)
Variables ¶
View Source
var ( BROWSER_BINPATH = "" BROWSER_INSTALLED = false //true if a browser not downloaded by Inox is present )
View Source
var ( HANDLE_PROPNAMES = []string{"nav", "wait_visible", "click", "screenshot_page", "html_node", "close"} ErrBrowserAutomationNotAllowed = errors.New("browser automation is not allowed") )
View Source
var DefaultBrowserDir = filepath.Join(map[string]string{ "linux": filepath.Join(os.Getenv("HOME"), ".cache"), }[runtime.GOOS], "inox", "browser")
DefaultBrowserDir for downloaded browser. For unix is "$HOME/.cache/inox/browser",
View Source
var (
ErrPageFailedToLoad = errors.New("page failed to load")
)
View Source
var (
ErrProxyAlreadyStarted = errors.New("browser proxy already started")
)
Functions ¶
func AllowBrowserAutomation ¶
func AllowBrowserAutomation()
func DisallowBrowserAutomation ¶
func DisallowBrowserAutomation()
func DownloadBrowser ¶
DownloadBrowser downloads a chrome browser, no permissions are checked.
func IsBrowserAutomationAllowed ¶
func IsBrowserAutomationAllowed() bool
func LookPath ¶
LookPath searches for the browser executable from often used paths on current operating system.
func NewChromeNamespace ¶
func SetBrowserBinPath ¶
func SetBrowserBinPath(val string)
func SetBrowserBinPathToInstalledOrCachedBrowser ¶
func SetBrowserBinPathToInstalledOrCachedBrowser() bool
func StartSharedProxy ¶
StartSharedProxy starts an HTTP proxy in another goroutine, the proxy is used by all browser instances controlled by the current package.
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
func (*Handle) GetGoMethod ¶
func (h *Handle) GetGoMethod(name string) (*core.GoFunction, bool)
func (*Handle) PrettyPrint ¶
func (*Handle) Screenshot ¶
func (*Handle) ScreenshotPage ¶
func (*Handle) ToSymbolicValue ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.