webdriver

package module
v0.0.0-...-b75f2bf Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 14 Imported by: 0

README

This package implements a W3C WebDriver to remotely control web browsers without running Selenium.

Supported browsers

  • Chrome

Install

go get github.com/dsmontoya/webdriver

Usage

TODO: add examples

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultChromeOptions = []ChromeOption{
	ChromePort(9515),
	ChromeURLBase(""),
	ChromeHTTPThreads(4),
	ChromeLogPath("./chrome.log"),
	ChromeStartTimeout(20 * time.Second),
}

Functions

func GetDefaultPrefs

func GetDefaultPrefs() map[string]interface{}

Populate a map with default firefox preferences

func NewAPIClient

func NewAPIClient() *api.APIClient

Types

type Chrome

type Chrome struct {
	URL *url.URL

	// Log file to dump chromedriver stdout/stderr. If "" send to terminal. Default: ""
	LogFile string
	// contains filtered or unexported fields
}

func NewChrome

func NewChrome(path string, options ...ChromeOption) *Chrome

NewChrome returns a new Chrome. It sets the corresponding DefaultChromeOptions option for each option not provided.

func (*Chrome) Start

func (c *Chrome) Start() error

func (*Chrome) Stop

func (d *Chrome) Stop() error

type ChromeOption

type ChromeOption func(*Chrome)

func ChromeHTTPThreads

func ChromeHTTPThreads(httpThreads int64) ChromeOption

func ChromeLogPath

func ChromeLogPath(logPath string) ChromeOption

func ChromePort

func ChromePort(port int64) ChromeOption

func ChromeStartTimeout

func ChromeStartTimeout(startTimeout time.Duration) ChromeOption

func ChromeURLBase

func ChromeURLBase(urlBase string) ChromeOption

type FirefoxDriver

type FirefoxDriver struct {
	URL string
	// The port firefox webdriver listens on. This port - 1 will be used as a mutex to avoid starting multiple firefox instances listening to the same port. Default: 7055
	Port int
	// Start method fails if lock (see Port) is not acquired before LockPortTimeout. Default 60s
	LockPortTimeout time.Duration
	// Start method fails if Firefox doesn't start in less than StartTimeout. Default 20s.
	StartTimeout time.Duration
	// Log file to dump firefox stdout/stderr. If "" send to terminal. Default: ""
	LogFile string
	// Firefox preferences. Default: see method GetDefaultPrefs
	Prefs map[string]interface{}
	// If temporary profile has to be deleted when closing. Default: true
	DeleteProfileOnClose bool
	// contains filtered or unexported fields
}

func NewFirefoxDriver

func NewFirefoxDriver(firefoxPath string, xpiPath string) *FirefoxDriver

func (*FirefoxDriver) SetLogPath

func (d *FirefoxDriver) SetLogPath(path string)

Equivalent to setting the following firefox preferences to: "webdriver.log.file": path/jsconsole.log "webdriver.log.driver.file": path/driver.log "webdriver.log.profiler.file": path/profiler.log "webdriver.log.browser.file": path/browser.log

func (*FirefoxDriver) Start

func (d *FirefoxDriver) Start() error

func (*FirefoxDriver) Stop

func (d *FirefoxDriver) Stop() error

type InstallRDF

type InstallRDF struct {
	Description InstallRDFDescription
}

type InstallRDFDescription

type InstallRDFDescription struct {
	Id string `xml:"id"`
}

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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