firefox

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package firefox provides Firefox-specific types for WebDriver.

Index

Constants

View Source
const CapabilitiesKey = "moz:firefoxOptions"

CapabilitiesKey is the name of the Firefox-specific key in the WebDriver capabilities object.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	// Binary is the absolute path of the Firefox binary, e.g. /usr/bin/firefox
	// or /Applications/Firefox.app/Contents/MacOS/firefox, to select which
	// custom browser binary to use. If left undefined, geckodriver will attempt
	// to deduce the default location of Firefox on the current system.
	Binary string `json:"binary,omitempty"`
	// Args are the command line arguments to pass to the Firefox binary. These
	// must include the leading -- where required e.g. ["--devtools"].
	Args []string `json:"args,omitempty"`
	// Profile is the Base64-encoded zip file of a profile directory to use as
	// the profile for the Firefox instance. This may be used to e.g.
	// install extensions or custom certificates. Use the SetProfile method
	// to load an existing profile from a file system.
	Profile string `json:"profile,omitempty"`
	// Log specifies the logging options for Gecko.
	Log *Log `json:"log,omitempty"`
	// Map of preference name to preference value, which can be a string, a
	// boolean or an integer.
	Prefs map[string]interface{} `json:"prefs,omitempty"`
}

Capabilities provides Firefox-specific options to WebDriver.

func (*Capabilities) SetProfile

func (c *Capabilities) SetProfile(basePath string) error

SetProfile sets the Profile datum with a Base64-encoded zip file of a profile directory that is specified by basePath. This directory should directly contain the profile's files, e.g. "user.js".

Note that a zip file will be created in memory and then the zip file will be base64-encoded. This will require memory at least 2x the size of the data.

type Log

type Log struct {
	// Level is the verbosity level of logs that Firefox should output.
	Level LogLevel `json:"level"`
}

Log specifies how Firefox should log debug data.

type LogLevel

type LogLevel string

LogLevel is an enum that defines logging levels for Firefox.

const (
	Trace  LogLevel = "trace"
	Debug  LogLevel = "debug"
	Config LogLevel = "config"
	Info   LogLevel = "info"
	Warn   LogLevel = "warn"
	Error  LogLevel = "error"
	Fatal  LogLevel = "fatal"
)

Levels of logging that can be specified in the Log structure.

Jump to

Keyboard shortcuts

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