venomWeb

package
v0.0.0-...-87f9f75 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package venomWeb provide class to interact easily with web driver

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineLogLevel

func DefineLogLevel(logLevel string)

Types

type Element

type Element struct {
	// contains filtered or unexported fields
}

func (Element) Check

func (elt Element) Check() error

Check method allow to check a checkbox web element Return nil if operation proceed with success, return an error else

func (Element) Clear

func (elt Element) Clear() error

Clear method allow to clear text value of a web element Return nil if operation proceed with success, return an error else

func (Element) Click

func (elt Element) Click() error

Click method allow to click on a web element Return nil if operation proceed with success, return an error else "invalid session id" error occured when session not found "invalid element id" error occured when element not found

func (Element) DoubleClick

func (elt Element) DoubleClick() error

Double click method allow to proceed a double click action on a web element Return nil if operation proceed with success, return an error else

func (Element) FindElement

func (elt Element) FindElement(selector string, selectorStrategy string) (Element, error)

FindElement method allow to search a web element from a parent element Return the element if operation proceed with success, return an error else

func (Element) FindElements

func (elt Element) FindElements(selector string, selectorStrategy string) ([]Element, error)

FindElements method allow to search web elements from a parent element Return element list if operation proceed with success, return an error else

func (Element) GetComputedLabel

func (elt Element) GetComputedLabel() (string, error)

GetComputedLabel method allow to get computed label of the current element Return computed label if operation proceed with success, return an error else

func (Element) GetComputedRole

func (elt Element) GetComputedRole() (string, error)

GetComputedRole method allow to get computed role of the current element Return computed role if operation proceed with success, return an error else

func (Element) GetElementCSSValue

func (elt Element) GetElementCSSValue(propertyName string) (string, error)

GetElementCSSValue method allow to get CSS property of the current element Return property value if operation proceed with success, return an error else

func (Element) GetElementProperty

func (elt Element) GetElementProperty(propertyName string) (string, error)

GetElementProperty method allow to get HTML property of the current element Return property value if operation proceed with success, return an error else

func (Element) GetElementRect

func (elt Element) GetElementRect() (common.Rect, error)

GetElementRect method allow to get element position Return element position if operation proceed with success, return an error else

func (Element) GetElementShadowRoot

func (elt Element) GetElementShadowRoot() (Element, error)

GetElementShadowRoot method allow to identify root shadow element from a parent element Return element if operation proceed with success, return an error else

func (Element) GetElementTagName

func (elt Element) GetElementTagName() (string, error)

GetElementTagName method allow to get tag name of the current element Return tag name if operation proceed with success, return an error else

func (Element) GetElementText

func (elt Element) GetElementText() (string, error)

GetElementText method allow to get text of the current element Return text if operation proceed with success, return an error else

func (Element) IsElementEnabled

func (elt Element) IsElementEnabled() (bool, error)

IsElementEnabled method allow to identify if element enabled or not Return if element is enabled if operation proceed with success, return an error else

func (Element) IsElementSelected

func (elt Element) IsElementSelected() (bool, error)

IsElementSelected method allow to identify if the current element is selected or not Return a boolean to indicate if element selected, return an error else

func (Element) Select

func (elt Element) Select(text string) (Element, error)

Select method allow to select an option of a list of values element (<select>) Return otpion element if operation proceed with success, return an error else

func (Element) SendKeys

func (elt Element) SendKeys(text string) error

SendKeys method allow to send text value on web element Return nil if operation proceed with success, return an error else

func (Element) TakeScreenshot

func (elt Element) TakeScreenshot(fileName string) error

TakeScreenshot method allow to save the screenshot of the current element Return nil if operation proceed with success, return an error else

func (Element) Uncheck

func (elt Element) Uncheck() error

Uncheck method allow to uncheck a checkbox web element Return nil if operation proceed with success, return an error else

func (Element) UploadFile

func (elt Element) UploadFile(file string) error

UploadFile method allow to upload file on an upload web element Return nil if operation proceed with success, return an error else

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (Session) AcceptAlert

func (s Session) AcceptAlert() error

func (Session) AddCookie

func (s Session) AddCookie(cookie common.Cookie) error

func (Session) Back

func (s Session) Back() error

func (Session) CloseWindow

func (s Session) CloseWindow() error

func (Session) DeleteAllCookies

func (s Session) DeleteAllCookies() error

func (Session) DeleteCookie

func (s Session) DeleteCookie(cookieName string) error

func (Session) DeleteSession

func (s Session) DeleteSession() error

Delete session method allow to destroy web driver session Return nil if operation proceed with success, return an error else

func (Session) DismissAlert

func (s Session) DismissAlert() error

func (Session) ExecuteAsyncScript

func (s Session) ExecuteAsyncScript(script string, args []string) error

func (Session) ExecuteScript

func (s Session) ExecuteScript(script string, args []string) error

func (Session) FindElement

func (s Session) FindElement(selector string, locatorStrategy string) (Element, error)

func (Session) FindElements

func (s Session) FindElements(selector string, locatorStrategy string) ([]Element, error)

func (Session) Forward

func (s Session) Forward() error

func (Session) Fullscreen

func (s Session) Fullscreen() error

func (Session) GetActiveElement

func (s Session) GetActiveElement() (Element, error)

func (Session) GetAlertText

func (s Session) GetAlertText() (string, error)

func (Session) GetAllCookies

func (s Session) GetAllCookies() ([]string, error)

func (Session) GetNamedCookie

func (s Session) GetNamedCookie(cookieName string) (string, error)

func (Session) GetPageSource

func (s Session) GetPageSource() (string, error)

func (Session) GetSize

func (s Session) GetSize() (common.Rect, error)

func (Session) GetTimeouts

func (s Session) GetTimeouts() (common.Timeouts, error)

GetTimeouts method allow to get timeout values Return timeout object if operation succeed, return an error else

func (Session) GetTitle

func (s Session) GetTitle() (string, error)

func (Session) GetURL

func (s Session) GetURL() (string, error)

GetURL method allow to get the current web driver URL Return URL if operation succeed, return an error else

func (Session) GetWindow

func (s Session) GetWindow() (Window, error)

func (Session) GetWindows

func (s Session) GetWindows() ([]Window, error)

func (Session) Maximize

func (s Session) Maximize() error

func (Session) Minimize

func (s Session) Minimize() error

func (Session) Navigate

func (s Session) Navigate(url string) error

Navigate method allow to change the current web driver url Return nil if operation succeed, return an error else

func (Session) NewWindow

func (s Session) NewWindow(windowType string) (Window, error)

func (Session) NextWindow

func (s Session) NextWindow() error

func (Session) Refresh

func (s Session) Refresh() error

func (Session) Reset

func (s Session) Reset() error

Reset current session allow to reset web driver state Return nil if operation proceed with sucess, return an error else

func (Session) SendAlertText

func (s Session) SendAlertText(alertText string) error

func (Session) SetTimeouts

func (s Session) SetTimeouts(timeouts common.Timeouts) error

SetTimeouts method allow to set timeout value Return nil if operation succeed, return an error else

func (Session) Size

func (s Session) Size(width int, height int) error

func (Session) String

func (s Session) String() string

func (Session) SwitchToFrame

func (s Session) SwitchToFrame(element Element) error

func (Session) SwitchToIndexFrame

func (s Session) SwitchToIndexFrame(index int) error

func (Session) SwitchToParentFrame

func (s Session) SwitchToParentFrame() error

func (Session) SyncElement

func (s Session) SyncElement(selector string, locatorStrategy string, timeout int64) error

SyncElement allow to wait the web element creation Return nil if operation succeed, return an error else

func (Session) SyncElementAbsence

func (s Session) SyncElementAbsence(selector string, locatorStrategy string, timeout int64) error

SyncElementAbsence allow to wait the web element deletion Return nil if operation succeed, return an error else

func (Session) SyncElementCSSValue

func (s Session) SyncElementCSSValue(selector string, locatorStrategy string, timeout int64, CSSPropertyName string, expectedValue string) error

SyncElementCSSValue allow to wait a specific CSS value of an element Return nil if operation succeed, return an error else

func (Session) SyncElementProperyValue

func (s Session) SyncElementProperyValue(selector string, locatorStrategy string, timeout int64, CSSPropertyName string, expectedValue string) error

SyncElementPropertyValue allow to wait a specific property value of an element Return nil if operation succeed, return an error else

func (Session) SyncElementText

func (s Session) SyncElementText(selector string, locatorStrategy string, timeout int64, expectedText string) error

SyncElementText allow to wait text value of an element Return nil if operation succeed, return an error else WebSite to test this feature: https://www.w3schools.com/w3css/w3css_progressbar.asp

func (Session) TakeScreenshot

func (s Session) TakeScreenshot(fileName string) error

type Shadow

type Shadow struct {
	// contains filtered or unexported fields
}

func (Shadow) FindElementFromShadowId

func (s Shadow) FindElementFromShadowId(selector string, locatorStrategy string) (Element, error)

func (Shadow) FindElementsFromShadow

func (s Shadow) FindElementsFromShadow(shadowId string, selector string, locatorStrategy string) ([]Element, error)

type WebDriver

type WebDriver struct {
	Headless bool
	Proxy    string
	Detach   bool
	LogLevel string
	Timeout  time.Duration
	// contains filtered or unexported fields
}

func BraveDriver

func BraveDriver(browserBinary string, driverBinary string, args []string, prefs map[string]interface{}, port string) WebDriver

func ChromeDriver

func ChromeDriver(browserBinary string, driverBinary string, args []string, prefs map[string]interface{}, port string) WebDriver

func EdgeChroniumDriver

func EdgeChroniumDriver(browserBinary string, driverBinary string, args []string, prefs map[string]interface{}, port string) WebDriver

func GeckoDriver

func GeckoDriver(browserBinary string, driverBinary string, args []string, prefs map[string]interface{}, port string) WebDriver

func NewWebDriver

func NewWebDriver(webDriver *WebDriver) WebDriver

func OperaDriver

func OperaDriver(browserBinary string, driverBinary string, args []string, prefs map[string]interface{}, port string) WebDriver

func (*WebDriver) NewSession

func (w *WebDriver) NewSession() (Session, error)

Instanciate a new session to browser server

func (*WebDriver) Start

func (w *WebDriver) Start() error

Start web driver

func (*WebDriver) Status

func (w *WebDriver) Status() (common.DriverStatus, error)

func (*WebDriver) Stop

func (w *WebDriver) Stop() error

Stop service and delete session

type Window

type Window struct {
	// contains filtered or unexported fields
}

func (Window) SwitchWindow

func (w Window) SwitchWindow() error

Jump to

Keyboard shortcuts

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