Documentation ¶
Overview ¶
Package w3c is a generated GoMock package.
Package w3c is a generated GoMock package.
Package w3c is a generated GoMock package.
Index ¶
- Constants
- Variables
- func GetAcceptInsecureCerts(c Capabilities) bool
- func GetBrowserName(c Capabilities) string
- func GetBrowserVersion(c Capabilities) string
- func GetPlatformName(c Capabilities) string
- func GetStrictFileInteractability(c Capabilities) bool
- func GetUnhandledPromptBehavior(c Capabilities) string
- func GetWindowRect(c Capabilities) bool
- func IsUnknownWindowHandler(err error) bool
- func SetAcceptInsecureCerts(c Capabilities, flag bool) error
- func SetBrowserName(c Capabilities, name string) error
- func SetBrowserVersion(c Capabilities, v string) error
- func SetPageLoadStrategy(c Capabilities, strategy string) error
- func SetPlatformName(c Capabilities, platform Platform) error
- func SetProxy(c Capabilities, p *Proxy) error
- func SetStrictFileInteractability(c Capabilities, flag bool) error
- func SetTimeout(c Capabilities, t Timeout) error
- func SetUnhandledPromptBehavior(c Capabilities, prompt string) error
- func SetWindowRect(c Capabilities, flag bool) error
- func StatusText(sc int) string
- type Alert
- type BrowserOptions
- type Capabilities
- func (c Capabilities) GetBool(key string) (b bool)
- func (c Capabilities) GetFloat(key string) (f float64)
- func (c Capabilities) GetInt(key string) (i int)
- func (c Capabilities) GetString(key string) (s string)
- func (c Capabilities) GetStringSlice(key string) (s []string)
- func (c Capabilities) GetUint(key string) (i uint)
- func (c Capabilities) Has(key string) bool
- func (c Capabilities) Section(key string) Capabilities
- func (c Capabilities) Set(k string, v interface{}) Capabilities
- type Context
- type Cookie
- func (c Cookie) Delete(key string)
- func (c Cookie) Domain() string
- func (c Cookie) Expiry() int64
- func (c Cookie) Get(key string) interface{}
- func (c Cookie) HttpOnly() bool
- func (c Cookie) Name() string
- func (c Cookie) Path() string
- func (c Cookie) SameSite() string
- func (c Cookie) Secure() bool
- func (c Cookie) Set(key string, value interface{}) Cookie
- func (c Cookie) SetDomain(v string) Cookie
- func (c Cookie) SetExpiry(v int64) Cookie
- func (c Cookie) SetHttpOnly(v bool) Cookie
- func (c Cookie) SetName(v string) Cookie
- func (c Cookie) SetPath(v string) Cookie
- func (c Cookie) SetSameSite(v string) Cookie
- func (c Cookie) SetSecure(v bool) Cookie
- func (c Cookie) SetValue(v interface{}) Cookie
- func (c Cookie) ToParams() Params
- func (c Cookie) Validate() error
- func (c Cookie) Value() interface{}
- type Cookies
- type Document
- type Doer
- type Elements
- type Error
- type FindElementStrategy
- type Frame
- type FrameHandle
- type Key
- type MockBrowserOptions
- type MockBrowserOptionsMockRecorder
- type MockDoer
- type MockDoerMockRecorder
- type MockSession
- type MockSessionMockRecorder
- type Navigation
- type Params
- type Platform
- type Point
- type Proxy
- type ProxyType
- type Rect
- type Response
- type ScreenCapture
- type Session
- type Status
- type Timeout
- type Timeouts
- type WebElement
- type Window
- type WindowHandle
- type WindowType
Constants ¶
const ( CapabilityBrowserName = "browserName" CapabilityBrowserVersion = "browserVersion" CapabilityPlatformName = "platformName" CapabilityAcceptInsecureCerts = "acceptInsecureCerts" CapabilityPageLoadStrategy = "pageLoadStrategy" CapabilityProxy = "proxy" CapabilitySetWindowRect = "setWindowRect" CapabilityTimeouts = "timeouts" CapabilityUnhandledPromptBehavior = "unhandledPromptBehavior" CapabilityStrictFileInteractability = "strictFileInteractability" )
const ( // CookieNameKey the name of the cookie. CookieNameKey = "name" // CookieValueKey the cookie value. CookieValueKey = "value" // CookiePathKey the cookie path. Defaults to "/" if omitted when adding a cookie. CookiePathKey = "path" // CookieDomainKey the domain the cookie is visible to. Defaults to the current browsing context’s active // document’s URL domain if omitted when adding a cookie. CookieDomainKey = "domain" // CookieSecureKey whether the cookie is a secure cookie. Defaults to false if omitted when adding a cookie. CookieSecureKey = "secure" // CookieExpiryKey when the cookie expires, specified in seconds since Unix Epoch. Must not be set if omitted when adding a cookie. CookieExpiryKey = "expiry" // CookieHttpOnlyKey whether the cookie is an HTTP only cookie. Defaults to false if omitted when adding a cookie. CookieHttpOnlyKey = "httpOnly" // CookieSameSiteKey whether the cookie applies to a SameSite policy. Defaults to None if omitted when adding a cookie. // Can be set to either "Lax" or "Strict". CookieSameSiteKey = "sameSite" )
const ( // Returns an element whose ID attribute matches the search value. ByID = FindElementStrategy("id") // Returns an element matching an XPath expression. ByXPATH = FindElementStrategy("xpath") // Returns an anchor element whose visible text matches the search value. ByLinkText = FindElementStrategy("link text") // Returns an anchor element whose visible text partially matches the search value. ByPartialLinkText = FindElementStrategy("partial link text") // Returns an element whose NAME attribute matches the search value. ByName = FindElementStrategy("name") // Returns an element whose tag name matches the search value. ByTagName = FindElementStrategy("tag name") // Returns an element whose class name contains the search value. // Compound class names are not permitted. ByClassName = FindElementStrategy("class name") // Returns an element matching a CSS selector. ByCSSSelector = FindElementStrategy("css selector") )
Methods by which to find elements.
const ( NullKey = Key('\ue000') CancelKey = Key('\ue001') HelpKey = Key('\ue002') BackspaceKey = Key('\ue003') TabKey = Key('\ue004') ClearKey = Key('\ue005') ReturnKey = Key('\ue006') EnterKey = Key('\ue007') ShiftKey = Key('\ue008') ControlKey = Key('\ue009') AltKey = Key('\ue00a') PauseKey = Key('\ue00b') EscapeKey = Key('\ue00c') SpaceKey = Key('\ue00d') PageUpKey = Key('\ue00e') PageDownKey = Key('\ue00f') EndKey = Key('\ue010') HomeKey = Key('\ue011') LeftArrowKey = Key('\ue012') UpArrowKey = Key('\ue013') RightArrowKey = Key('\ue014') DownArrowKey = Key('\ue015') InsertKey = Key('\ue016') DeleteKey = Key('\ue017') SemicolonKey = Key('\ue018') EqualsKey = Key('\ue019') Numpad0Key = Key('\ue01a') Numpad1Key = Key('\ue01b') Numpad2Key = Key('\ue01c') Numpad3Key = Key('\ue01d') Numpad4Key = Key('\ue01e') Numpad5Key = Key('\ue01f') Numpad6Key = Key('\ue020') Numpad7Key = Key('\ue021') Numpad8Key = Key('\ue022') Numpad9Key = Key('\ue023') MultiplyKey = Key('\ue024') AddKey = Key('\ue025') SeparatorKey = Key('\ue026') SubstractKey = Key('\ue027') DecimalKey = Key('\ue028') DivideKey = Key('\ue029') F1Key = Key('\ue031') F2Key = Key('\ue032') F3Key = Key('\ue033') F4Key = Key('\ue034') F5Key = Key('\ue035') F6Key = Key('\ue036') F7Key = Key('\ue037') F8Key = Key('\ue038') F9Key = Key('\ue039') F10Key = Key('\ue03a') F11Key = Key('\ue03b') F12Key = Key('\ue03c') MetaKey = Key('\ue03d') )
Special keyboard keys, for SendKeys.
const ( SuccessStatusCode = 0 NoSuchDriverStatusCode = 6 NoSuchElementStatusCode = 7 NoSuchFrameStatusCode = 8 UnknownCommandStatusCode = 9 StaleElementReferenceStatusCode = 10 ElementNotVisibleStatusCode = 11 InvalidElementStateStatusCode = 12 UnknownErrorStatusCode = 13 ElementIsNotSelectableStatusCode = 15 JavaScriptErrorStatusCode = 17 XPathLookupErrorStatusCode = 19 TimeoutStatusCode = 21 NoSuchWindowStatusCode = 23 InvalidCookieDomainStatusCode = 24 UnableToSetCookieStatusCode = 25 UnexpectedAlertOpenStatusCode = 26 NoAlertOpenErrorStatusCode = 27 ScriptTimeoutStatusCode = 28 InvalidElementCoordinatesStatusCode = 29 IMENotAvailableStatusCode = 30 IMEEngineActivationFailedStatusCode = 31 InvalidSelectorStatusCode = 32 SessionNotCreatedExceptionStatusCode = 33 MoveTargetOutOfBoundsStatusCode = 34 )
const ( StatusMissingCommandParameters = "400: Missing Command Parameters" StatusUnknownCommand = "404: Unknown command/Resource Not Found" StatusInvalidCommandMethod = "405: Invalid Command Method" StatusFailedCommand = "500: Failed Command" StatusUnimplementedCommand = "501: Unimplemented Command" )
const WebElementIdentifier = "element-6066-11e4-a52e-4f735466cecf"
WebElementIdentifier the web element identifier is the string constant.
Variables ¶
var ( ErrInvalidResponse = errors.New("w3c: invalid response") ErrInvalidArguments = errors.New("w3c: invalid arguments") ErrUnknownWindowHandler = errors.New("w3c: unknown window handler") ErrNoSuchElement = errors.New("w3c: no such element") )
var ( ErrResponseWithoutBody = errors.New("w3c: response without body") ErrEmptyResponse = errors.New("w3c: empty response") )
var (
ErrInvalidCookie = errors.New("protocol: cookie name and value is required")
)
var ErrUnknownSession = errors.New("w3cproto: unknown session id")
Functions ¶
func GetAcceptInsecureCerts ¶
func GetAcceptInsecureCerts(c Capabilities) bool
func GetBrowserName ¶
func GetBrowserName(c Capabilities) string
func GetBrowserVersion ¶
func GetBrowserVersion(c Capabilities) string
func GetPlatformName ¶
func GetPlatformName(c Capabilities) string
func GetStrictFileInteractability ¶
func GetStrictFileInteractability(c Capabilities) bool
func GetUnhandledPromptBehavior ¶
func GetUnhandledPromptBehavior(c Capabilities) string
func GetWindowRect ¶
func GetWindowRect(c Capabilities) bool
func IsUnknownWindowHandler ¶
func SetAcceptInsecureCerts ¶
func SetAcceptInsecureCerts(c Capabilities, flag bool) error
func SetBrowserName ¶
func SetBrowserName(c Capabilities, name string) error
func SetBrowserVersion ¶
func SetBrowserVersion(c Capabilities, v string) error
func SetPageLoadStrategy ¶
func SetPageLoadStrategy(c Capabilities, strategy string) error
func SetPlatformName ¶
func SetPlatformName(c Capabilities, platform Platform) error
func SetProxy ¶
func SetProxy(c Capabilities, p *Proxy) error
func SetStrictFileInteractability ¶
func SetStrictFileInteractability(c Capabilities, flag bool) error
func SetTimeout ¶
func SetTimeout(c Capabilities, t Timeout) error
func SetUnhandledPromptBehavior ¶
func SetUnhandledPromptBehavior(c Capabilities, prompt string) error
func SetWindowRect ¶
func SetWindowRect(c Capabilities, flag bool) error
func StatusText ¶
Types ¶
type Alert ¶
type Alert interface { // Dismiss dismisses a simple dialog if present. // A request to dismiss an alert user prompt, which may not necessarily have a dismiss button, // has the same effect as accepting it. Dismiss(ctx context.Context) error // Accept accepts the currently displayed alert dialog. Accept(ctx context.Context) error // Text gets the text of the currently displayed JavaScript alert(), confirm(), or prompt() dialog. Text(ctx context.Context) (string, error) // SetText sets the text field of a window.prompt user prompt to the given value. SetText(ctx context.Context, text string) error }
type BrowserOptions ¶
type BrowserOptions interface { FirstMatch() []Capabilities AlwaysMatch() Capabilities }
func NewBrowserOptions ¶
func NewBrowserOptions(alwaysMatch Capabilities, firstMatch []Capabilities) BrowserOptions
NewBrowserOptions returns an instance of BrowserOptions.
type Capabilities ¶
type Capabilities map[string]interface{}
func MakeCapabilities ¶
func MakeCapabilities() Capabilities
func (Capabilities) GetBool ¶
func (c Capabilities) GetBool(key string) (b bool)
func (Capabilities) GetFloat ¶
func (c Capabilities) GetFloat(key string) (f float64)
func (Capabilities) GetInt ¶
func (c Capabilities) GetInt(key string) (i int)
func (Capabilities) GetString ¶
func (c Capabilities) GetString(key string) (s string)
func (Capabilities) GetStringSlice ¶
func (c Capabilities) GetStringSlice(key string) (s []string)
func (Capabilities) GetUint ¶
func (c Capabilities) GetUint(key string) (i uint)
func (Capabilities) Has ¶
func (c Capabilities) Has(key string) bool
func (Capabilities) Section ¶
func (c Capabilities) Section(key string) Capabilities
func (Capabilities) Set ¶
func (c Capabilities) Set(k string, v interface{}) Capabilities
type Context ¶
type Context interface { // GetWindowHandle returns the current window handle. GetWindowHandle(context.Context) (WindowHandle, error) // GetWindowHandles returns the list of all window handles available to the session. GetWindowHandles(context.Context) ([]WindowHandle, error) // CloseWindow close the current window. CloseWindow(context.Context) ([]WindowHandle, error) // NewWindow create a new top-level browsing context. NewWindow(context.Context, WindowType) (Window, error) // SwitchToWindow switching window will select the current top-level browsing context used as the target // for all subsequent commands. In a tabbed browser, this will typically make the tab containing // the browsing context the selected tab. SwitchToWindow(context.Context, WindowHandle) error // SwitchToFrame change focus to another frame on the page. SwitchToFrame(context.Context, FrameHandle) error // SwitchToParentFrame change focus back to parent frame. SwitchToParentFrame(context.Context) error // SetRect alters the size and the position of the operating system window // corresponding to the current top-level browsing context. SetRect(context.Context, Rect) (Rect, error) // returns the size and position on the screen of the operating system // window corresponding to the current top-level browsing context. GetRect(context.Context) (Rect, error) // Maximize invokes the window manager-specific “maximize” operation, // if any, on the window containing the current top-level browsing context. // This typically increases the window to the maximum available size without going full-screen. Maximize(context.Context) (Rect, error) // Minimize invokes the window manager-specific “minimize” operation, // if any, on the window containing the current top-level browsing context. // This typically hides the window in the system tray. Minimize(context.Context) (Rect, error) // Fullscreen fullscreen mode. Fullscreen(context.Context) (Rect, error) }
Context represents a window handle with a unique identifier.
func NewContext ¶
NewContext creates a new instance of Context.
type Cookie ¶
type Cookie map[string]interface{}
func MakeCookie ¶
func MakeCookie() Cookie
func (Cookie) SetHttpOnly ¶
func (Cookie) SetSameSite ¶
type Cookies ¶
type Cookies interface { // All returns an all cookies visible to the current page. All(context.Context) ([]Cookie, error) // Get returns a cookie by name visible to the current page. Get(context.Context, string) (Cookie, error) // Add adds a cookie. Add(context.Context, Cookie) error // Delete deletes cookies by name visible to the current page. Delete(context.Context, string) error // DeleteAll deletes all cookies visible to the current page. DeleteAll(context.Context) error }
Cookies represents a cookies protocol.
func NewCookies ¶
NewCookies creates a new instance of Cookie.
type Document ¶
type Document interface { // GetPageSource returns a string serialization of the DOM of the current browsing context active document. GetPageSource(ctx context.Context) (source string, err error) // ExecuteScript inject a snippet of JavaScript into the page for execution in the context of the currently // selected frame. The executed script is assumed to be synchronous and the result of evaluating the script // is returned to the client. The script argument defines the script to execute in the form of a function body. // The value returned by that function will be returned to the client. The function will be invoked with // the provided args array and the values may be accessed via the arguments object in the order specified. // Arguments may be any JSON-primitive, array, or JSON object. JSON objects that define a WebElement // reference will be converted to the corresponding DOM element. Likewise, any WebElements in the script result // will be returned to the client as WebElement JSON objects. ExecuteScript(ctx context.Context, script string, args []interface{}) ([]byte, error) // ExecuteAsyncScript inject a snippet of JavaScript into the page for execution in the context of the // currently selected frame. The executed script is assumed to be asynchronous and must signal that // is done by invoking the provided callback, which is always provided as the final argument to the function. // The value to this callback will be returned to the client. Asynchronous script commands may not span page loads. // If an unload event is fired while waiting for a script result, an error should be returned to the client. // The script argument defines the script to execute in teh form of a function body. The function will be invoked // with the provided args array and the values may be accessed via the arguments object in the order specified. // The final argument will always be a callback function that must be invoked to signal that the script has finished. // Arguments may be any JSON-primitive, array, or JSON object. JSON objects that define a WebElement reference // will be converted to the corresponding DOM element. Likewise, any WebElements in the script result // will be returned to the client as WebElement JSON objects. ExecuteAsyncScript(ctx context.Context, script string, args []interface{}) ([]byte, error) }
func NewDocument ¶
NewDocument creates a new instance of Document.
type Doer ¶
type Doer interface {
Do(ctx context.Context, method string, path string, p Params) (resp *Response, err error)
}
func WithClient ¶
func WithClient(client httpclient.Client) Doer
type Elements ¶
type Elements interface { // FindOne finds an element on the page, starting from the document root. FindOne(ctx context.Context, by FindElementStrategy, value string) (WebElement, error) // Find finds multiple elements on the page, starting from the document root. Find(ctx context.Context, by FindElementStrategy, value string) ([]WebElement, error) // Active returns the currently active element on the page. Active(ctx context.Context) (WebElement, error) }
func NewElements ¶
type Error ¶
type Error struct { Code string `json:"error"` Message string `json:"message"` RawStacktrace string `json:"stacktrace"` Data map[string]interface{} `json:"data"` Stacktrace []string }
Error represents a WebDriver protocol error.
type FindElementStrategy ¶
type FindElementStrategy string
type Frame ¶
type Frame struct {
Handle FrameHandle `json:"handle"`
}
type FrameHandle ¶
type FrameHandle string
func (FrameHandle) String ¶
func (fh FrameHandle) String() string
type MockBrowserOptions ¶
type MockBrowserOptions struct {
// contains filtered or unexported fields
}
MockBrowserOptions is a mock of BrowserOptions interface
func NewMockBrowserOptions ¶
func NewMockBrowserOptions(ctrl *gomock.Controller) *MockBrowserOptions
NewMockBrowserOptions creates a new mock instance
func (*MockBrowserOptions) AlwaysMatch ¶
func (m *MockBrowserOptions) AlwaysMatch() Capabilities
AlwaysMatch mocks base method
func (*MockBrowserOptions) EXPECT ¶
func (m *MockBrowserOptions) EXPECT() *MockBrowserOptionsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockBrowserOptions) FirstMatch ¶
func (m *MockBrowserOptions) FirstMatch() []Capabilities
FirstMatch mocks base method
type MockBrowserOptionsMockRecorder ¶
type MockBrowserOptionsMockRecorder struct {
// contains filtered or unexported fields
}
MockBrowserOptionsMockRecorder is the mock recorder for MockBrowserOptions
func (*MockBrowserOptionsMockRecorder) AlwaysMatch ¶
func (mr *MockBrowserOptionsMockRecorder) AlwaysMatch() *gomock.Call
AlwaysMatch indicates an expected call of AlwaysMatch
func (*MockBrowserOptionsMockRecorder) FirstMatch ¶
func (mr *MockBrowserOptionsMockRecorder) FirstMatch() *gomock.Call
FirstMatch indicates an expected call of FirstMatch
type MockDoer ¶
type MockDoer struct {
// contains filtered or unexported fields
}
MockDoer is a mock of Doer interface
func NewMockDoer ¶
func NewMockDoer(ctrl *gomock.Controller) *MockDoer
NewMockDoer creates a new mock instance
func (*MockDoer) EXPECT ¶
func (m *MockDoer) EXPECT() *MockDoerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockDoerMockRecorder ¶
type MockDoerMockRecorder struct {
// contains filtered or unexported fields
}
MockDoerMockRecorder is the mock recorder for MockDoer
func (*MockDoerMockRecorder) Do ¶
func (mr *MockDoerMockRecorder) Do(ctx, method, path, p interface{}) *gomock.Call
Do indicates an expected call of Do
type MockSession ¶
type MockSession struct {
// contains filtered or unexported fields
}
MockSession is a mock of Session interface
func NewMockSession ¶
func NewMockSession(ctrl *gomock.Controller) *MockSession
NewMockSession creates a new mock instance
func (*MockSession) Capabilities ¶
func (m *MockSession) Capabilities() Capabilities
Capabilities mocks base method
func (*MockSession) Delete ¶
func (m *MockSession) Delete(arg0 context.Context) error
Delete mocks base method
func (*MockSession) EXPECT ¶
func (m *MockSession) EXPECT() *MockSessionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockSessionMockRecorder ¶
type MockSessionMockRecorder struct {
// contains filtered or unexported fields
}
MockSessionMockRecorder is the mock recorder for MockSession
func (*MockSessionMockRecorder) Capabilities ¶
func (mr *MockSessionMockRecorder) Capabilities() *gomock.Call
Capabilities indicates an expected call of Capabilities
func (*MockSessionMockRecorder) Delete ¶
func (mr *MockSessionMockRecorder) Delete(arg0 interface{}) *gomock.Call
Delete indicates an expected call of Delete
func (*MockSessionMockRecorder) ID ¶
func (mr *MockSessionMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID
func (*MockSessionMockRecorder) Status ¶
func (mr *MockSessionMockRecorder) Status(arg0 interface{}) *gomock.Call
Status indicates an expected call of Status
type Navigation ¶
type Navigation interface { context.Context, url string) (err error) GetCurrentURL(ctx context.Context) (url string, err error) Back(ctx context.Context) error Forward(ctx context.Context) error Refresh(ctx context.Context) error GetTitle(ctx context.Context) (title string, err error) }NavigateTo(ctx
Navigation represents a navigation of the current session context
func NewNavigation ¶
func NewNavigation(doer Doer, sessID string) Navigation
NewNavigation creates a new instance of Navigation.
type Proxy ¶
type Proxy struct { // Type is the type of proxy to use. This is required to be populated. Type ProxyType `json:"proxyType"` // AutoconfigURL is the URL to be used for proxy auto configuration. This is // required if Type is set to PAC. AutoconfigURL string `json:"proxyAutoconfigUrl,omitempty"` // The following are used when Type is set to Manual. // // Note that in Firefox, connections to localhost are not proxied by default, // even if a proxy is set. This can be overridden via a preference setting. FTP string `json:"ftpProxy,omitempty"` HTTP string `json:"httpProxy,omitempty"` SSL string `json:"sslProxy,omitempty"` SOCKS string `json:"socksProxy,omitempty"` SOCKSUsername string `json:"socksUsername,omitempty"` SOCKSPassword string `json:"socksPassword,omitempty"` NoProxy []string `json:"noProxy,omitempty"` // The W3C draft spec includes port fields as well. According to the // specification, ports can also be included in the above addresses. However, // in the Geckodriver implementation, the ports must be specified by these // additional fields. HTTPPort int `json:"httpProxyPort,omitempty"` SSLPort int `json:"sslProxyPort,omitempty"` SocksPort int `json:"socksProxyPort,omitempty"` }
Proxy specifies configuration for proxies in the browser. Set the key "proxy" in Capabilities to an instance of this type.
func GetProxy ¶
func GetProxy(c Capabilities) *Proxy
type ProxyType ¶
type ProxyType string
ProxyType is an enumeration of the types of proxies available.
const ( // ProxyDirect connection - no proxy in use. ProxyDirectType ProxyType = "direct" // ProxyManualType proxy settings configured, e.g. setting a proxy for HTTP, a proxy // for FTP, etc. ProxyManualType ProxyType = "manual" // ProxyAutodetectType proxy, probably with WPAD. ProxyAutodetectType ProxyType = "autodetect" // ProxySystemType settings used. ProxySystemType ProxyType = "system" // ProxyPACType - Proxy auto configuration from a URL. ProxyPACType ProxyType = "pac" )
type Response ¶
type Response struct { SessionID string `json:"sessionId"` Status int `json:"status"` Value json.RawMessage `json:"value"` }
type ScreenCapture ¶
type ScreenCapture interface { // Take takes a screenshot of the current page. Take(ctx context.Context) (io.Reader, error) // TakeElement takes a screenshot of the element on the current page. TakeElement(ctx context.Context, elementID string) (io.Reader, error) }
func NewScreenCapture ¶
func NewScreenCapture(doer Doer, sessionID string) ScreenCapture
NewScreenCapture creates a new instance of ScreenCapture.
type Session ¶
type Session interface { // ID returns the unique session id. ID() string // Capabilities returns the capabilities of the specified session. Capabilities() Capabilities // Status returns information about whether a remote end is in a state // in which it can create new sessions, but may additionally include arbitrary // meta information that is specific to the implementation. Status(context.Context) (Status, error) // Delete delete the session. Delete(context.Context) error }
Session represents the connection between a local end and a specific remote end. Session is equivalent to a single instantiation of a particular user agent, including all its child browsers.
func NewSession ¶
NewSession creates a new instance of Session. The new session command creates a new WebDriver session with the endpoint node. If the creation fails, a session not created error is returned.
type Status ¶
type Status struct { // protocol specification Ready bool `json:"ready"` Message string `json:"message"` // extension Build struct { Version string `json:"version"` Revision string `json:"revision"` Time string `json:"time"` } `json:"build"` OS struct { Arch string `json:"arch"` Name string `json:"name"` Version string `json:"version"` } `json:"os"` }
func (Status) HasExtensionInfo ¶
type Timeout ¶
type Timeout struct { Implicit uint `json:"implicit"` PageLoad uint `json:"pageLoad"` Script uint `json:"script"` }
func GetTimeout ¶
func GetTimeout(c Capabilities) *Timeout
func (Timeout) GetImplicit ¶
func (Timeout) GetPageLoad ¶
type Timeouts ¶
type Timeouts interface { // Get returns the timeouts implicit, pageLoad, script. Get(context.Context) (Timeout, error) // SetImplicit sets the amount of time the driver should wait when // searching for elements. The timeout will be rounded to nearest millisecond. SetImplicit(context.Context, time.Duration) error // SetPageLoad sets the amount of time the driver should wait when // loading a page. The timeout will be rounded to nearest millisecond. SetPageLoad(context.Context, time.Duration) error // SetScript sets the amount of time that asynchronous scripts // are permitted to run before they are aborted. The timeout will be rounded // to nearest millisecond. SetScript(context.Context, time.Duration) error }
Timeouts represents a timeouts that control the behavior of script evaluation, navigation, and element retrieval.
func NewTimeouts ¶
NewTimeouts creates a new instance of Timeouts.
type WebElement ¶
type WebElement interface { // ID returns the identifier of the element. ID() string // Click clicks on the element. Click(ctx context.Context) error // SendKeys types into the element. SendKeys(ctx context.Context, keys ...Key) error // Clear clears the element. Clear(ctx context.Context) error // FindOne finds a child element. FindOne(ctx context.Context, by FindElementStrategy, value string) (WebElement, error) // Find finds multiple children elements. Find(ctx context.Context, by FindElementStrategy, value string) ([]WebElement, error) // TagName returns the element's name. TagName(ctx context.Context) (string, error) // Text returns the text of the element. Text(ctx context.Context) (string, error) // IsSelected returns true if element is selected. IsSelected(ctx context.Context) (bool, error) // IsEnabled returns true if the element is enabled. IsEnabled(ctx context.Context) (bool, error) // GetAttribute returns the named attribute of the element. GetAttribute(ctx context.Context, name string) (string, error) // Rect returns the element's size. Rect(ctx context.Context) (Rect, error) // GetProperty returns the value of the specified property of the element. GetProperty(ctx context.Context, name string) (string, error) // GetCSSValue returns the value of the specified CSS property of the element. GetCSSValue(ctx context.Context, name string) (string, error) }
type Window ¶
type Window struct { Handle WindowHandle `json:"handle"` Type WindowType `json:"type"` }
type WindowHandle ¶
type WindowHandle string
func (WindowHandle) IsEmpty ¶
func (wh WindowHandle) IsEmpty() bool
func (WindowHandle) String ¶
func (wh WindowHandle) String() string
type WindowType ¶
type WindowType string
const ( Tab WindowType = "tab" Win WindowType = "window" )
func (WindowType) String ¶
func (wt WindowType) String() string
func (WindowType) Validate ¶
func (wt WindowType) Validate() error