README
¶
Selenium Runner
Selenium runner opens a web session to run a various action on web driver or web elements.
Service Id | Action | Description | Request | Response |
---|---|---|---|---|
selenium | start | start standalone selenium server | ServerStartRequest | ServerStartResponse |
selenium | stop | stop standalone selenium server | ServerStopRequest | ServerStopResponse |
selenium | open | open a new browser with session id for further testing | OpenSessionRequest | OpenSessionResponse |
selenium | close | close browser session | CloseSessionRequest | CloseSessionResponse |
selenium | call-driver | call a method on web driver, i.e wb.GET(url) | WebDriverCallRequest | ServiceCallResponse |
selenium | call-element | call a method on a web element, i.e. we.Click() | WebElementCallRequest | WebElementCallResponse |
selenium | run | run set of action on a page | RunRequest | RunResponse |
call-driver and call-element actions's method and parameters are proxied to stand along selenium server via selenium client
Selenium run request defines sequence of action/commands. In case a selector is not specified, call method's caller is a WebDriver, otherwise WebElement defined by selector. Wait provides ability to wait either some time amount or for certain condition to take place, with regexp to extract data
Run request provide commands expression for easy selenium interaction:
Command syntax:
[RESULT_KEY=] [(WEB_ELEMENT_SELECTOR).]METHOD_NAME(PARAMETERS)
i.e:
(#name).sendKeys('dummy 123')
(xpath://SELECT[@id='typeId']/option[text()='type1']).click()
get(http://127.0.0.1:8080/form.html)
Time wait
- command: CurrentURL = CurrentURL()
exit: $CurrentURL:/dummy/
sleepTimeMs: 1000
repeat: 10
Inline pipeline tasks
endly -r=test
Documentation
¶
Index ¶
- Constants
- func New() endly.Service
- func NewParser() *parser
- func Sessions(context *endly.Context) map[string]*Session
- type Action
- type CloseSessionRequest
- type CloseSessionResponse
- type MethodCall
- type OpenSessionRequest
- type OpenSessionResponse
- type RunRequest
- type RunResponse
- type ServiceCallResponse
- type Session
- type StartRequest
- type StartResponse
- type StopRequest
- type StopResponse
- type WebDriverCallRequest
- type WebElementCallRequest
- type WebElementCallResponse
- type WebElementSelector
- type WebSelector
Constants ¶
const ( //ServiceID represents a ServiceID ServiceID = "selenium" //Selenium represents name of selenium server Selenium = "selenium-server-standalone" //GeckoDriver represents name of gecko driver GeckoDriver = "geckodriver" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct { Key string //optional result key Selector *WebElementSelector Calls []*MethodCall }
Action represents various calls on web element
type CloseSessionRequest ¶
type CloseSessionRequest struct {
SessionID string
}
CloseSessionRequest represents close session request.
func NewCloseSessionRequestFromURL ¶
func NewCloseSessionRequestFromURL(URL string) (*CloseSessionRequest, error)
NewCloseSessionRequestFromURL creates a new close session request from URL
type CloseSessionResponse ¶
type CloseSessionResponse struct {
SessionID string
}
CloseSessionResponse represents close session response.
type MethodCall ¶
MethodCall represents selenium call.
func NewMethodCall ¶
func NewMethodCall(method string, repeatable *model.Repeater, parameters ...interface{}) *MethodCall
NewMethodCall creates a new method call
type OpenSessionRequest ¶
type OpenSessionRequest struct { Browser string RemoteSelenium *url.Resource `description:"http selenium server endpoint"` SessionID string `description:"if specified this ID will be used for a sessionID"` }
OpenSessionRequest represents open session request
func NewOpenSessionRequest ¶
func NewOpenSessionRequest(browser string, remote *url.Resource) *OpenSessionRequest
NewOpenSessionRequest creates a new open session request
func (*OpenSessionRequest) Validate ¶
func (r *OpenSessionRequest) Validate() error
Validate validate open session request
type OpenSessionResponse ¶
type OpenSessionResponse struct {
SessionID string
}
OpenSessionResponse represents open session response.
type RunRequest ¶
type RunRequest struct { SessionID string Browser string RemoteSelenium *url.Resource //remote selenium resource Actions []*Action Commands []interface{} `` /* 130-byte string literal not displayed */ Expect interface{} `description:"If specified it will validated response as actual"` }
RunRequest represents group of selenium web elements calls
func NewRunRequest ¶
func NewRunRequest(sessionID, browser string, remote *url.Resource, actions ...*Action) *RunRequest
NewRunRequest creates a new run request
func NewRunRequestFromURL ¶
func NewRunRequestFromURL(URL string) (*RunRequest, error)
NewRunRequestFromURL creates a new request from URL
func (*RunRequest) Init ¶
func (r *RunRequest) Init() error
func (*RunRequest) IsInput ¶
func (r *RunRequest) IsInput() bool
IsInput returns this request (CLI reporter interface)
func (*RunRequest) Messages ¶
func (r *RunRequest) Messages() []*msg.Message
IsInput returns this request (CLI reporter interface)
type RunResponse ¶
type RunResponse struct { SessionID string Data map[string]interface{} LookupErrors []string Assert *validator.AssertResponse }
RunResponse represents selenium call response
func (*RunResponse) IsOutput ¶
func (r *RunResponse) IsOutput() bool
IsOutput returns this response (CLI reporter interface)
func (*RunResponse) Messages ¶
func (r *RunResponse) Messages() []*msg.Message
Messages returns messages
type ServiceCallResponse ¶
ServiceCallResponse represents selenium call response
type StartRequest ¶
type StartRequest struct { Target *url.Resource Port int Sdk string SdkVersion string Version string }
StartRequest represents a selenium server start request
func NewStartRequestFromURL ¶
func NewStartRequestFromURL(URL string) (*StartRequest, error)
NewStartRequestFromURL creates a new start request from URL
func (*StartRequest) Validate ¶
func (r *StartRequest) Validate() error
type StartResponse ¶
StartResponse repreents a selenium server stop request
type StopRequest ¶
StopRequest represents server stop request
func NewStopRequestFromURL ¶
func NewStopRequestFromURL(URL string) (*StopRequest, error)
NewStopRequestFromURL creates a new start request from URL
type WebDriverCallRequest ¶
type WebDriverCallRequest struct { SessionID string Key string Call *MethodCall }
WebDriverCallRequest represents selenium call driver request
type WebElementCallRequest ¶
type WebElementCallRequest struct { SessionID string Selector *WebElementSelector Call *MethodCall }
WebElementCallRequest represents a web element call reqesut
type WebElementCallResponse ¶
type WebElementCallResponse struct { Result []interface{} LookupError string Data map[string]interface{} }
WebElementCallResponse represents seleniun web element response
type WebElementSelector ¶
type WebElementSelector struct { By string //selector type Value string //selector value Key string //optional result key }
WebElementSelector represents a web element selector
func NewWebElementSelector ¶
func NewWebElementSelector(by, value string) *WebElementSelector
NewWebElementSelector creates a new instance of web element selector
func (*WebElementSelector) Init ¶
func (s *WebElementSelector) Init() error
Validate checks is selector is valid.
func (*WebElementSelector) Validate ¶
func (s *WebElementSelector) Validate() error
Validate checks is selector is valid.
type WebSelector ¶
type WebSelector string
func (WebSelector) ByAndValue ¶
func (s WebSelector) ByAndValue() (by, value string)