engine

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	// LogLevel set loglevel threshold
	// If undefined or wrong set it to INFO level
	LogLevel logrus.Level
	// ForceDependenciesDl force re-download of all dependencies
	ForceDependenciesDl bool
	// Debug set selenium debug mode and display its logging to stderr
	Debug bool
	//DevTools launch Electron gui with devtools openned
	DevTools bool
	// IgnoreDependencies disable dependencies manager on startup
	IgnoreDependencies bool
	// Headless execute Selenium webdriver in headless mode
	Headless bool
	// Port : communication port
	Port uint16
}

ClientConfig struct centralize all client configuration and flags. Inizialized at program startup, not safe to modify this after.

func CreateClientConfig

func CreateClientConfig() *ClientConfig

CreateClientConfig create default ClientConfig instance and return a pointer on it

type Selenium

type Selenium struct {
	Instance           *selenium.Service
	Config             *ClientConfig
	Opts               []selenium.ServiceOption
	Proxy              proxy.Proxy `yaml:"proxy"`
	WebDriver          selenium.WebDriver
	SigTermRoutineExit chan bool
}

Selenium instance and opts

func (*Selenium) CleanUp

func (s *Selenium) CleanUp()

CleanUp clean app ressources including Selenium stuff and proxy-login-automator instance (if exist)

func (*Selenium) CloseSelenium

func (s *Selenium) CloseSelenium()

CloseSelenium close webdriver and selenium instances

func (*Selenium) Fatal

func (s *Selenium) Fatal(msg string, err error)

Fatal closes all selenium stuff and call logrus fatal with error printing

func (*Selenium) GetElement

func (s *Selenium) GetElement(elementTag, locator string) (selenium.WebElement, error)

GetElement wait for element and then return when it's available

func (*Selenium) GetElements

func (s *Selenium) GetElements(elementTag, locator string) ([]selenium.WebElement, error)

GetElements wait for elements and then return when they're available

func (*Selenium) InitChromeWebDriver

func (s *Selenium) InitChromeWebDriver()

InitChromeWebDriver init and launch web driver with Chrome

func (*Selenium) InitFirefoxWebDriver

func (s *Selenium) InitFirefoxWebDriver()

InitFirefoxWebDriver init and launch web driver with Firefox

func (*Selenium) InitializeSelenium

func (s *Selenium) InitializeSelenium(clientConfig *ClientConfig)

InitializeSelenium start a Selenium WebDriver server instance (if one is not already running).

func (*Selenium) IsElementPresent

func (s *Selenium) IsElementPresent(by, value string) bool

IsElementPresent check if an element is present on the current webpage

func (*Selenium) SigTermCleaning

func (s *Selenium) SigTermCleaning()

SigTermCleaning launch a gouroutine to handle SigTerm signal and trigger Selenium and Webdriver closing if it raised

func (*Selenium) WaitForElement

func (s *Selenium) WaitForElement(elementTag, locator string, delay int) (bool, error)

WaitForElement search and wait until searched element appears. Delay argument is in seconds.

Jump to

Keyboard shortcuts

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