Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(b ...bool)
- func DeleteSession(urlPrefix, id string) error
- func SetLogLevel(level logs.Level)
- type Actions
- type Capabilities
- type Condition
- type Cookie
- type Entity
- func (this *Entity) AddArgument(args ...string) *Entity
- func (this *Entity) Close()
- func (this *Entity) DelArgument(arg string) *Entity
- func (this *Entity) Run(f func(w *WebDriver) error, retry ...uint) error
- func (this *Entity) SetBrowser(b string) *Entity
- func (this *Entity) SetBrowserPath(p string) *Entity
- func (this *Entity) SetPref(key string, value interface{}) *Entity
- func (this *Entity) SetProxy(u string) *Entity
- func (this *Entity) SetUserAgent(ua string) *Entity
- func (this *Entity) SetUserAgentDefault() *Entity
- func (this *Entity) SetUserAgentRand() *Entity
- func (this *Entity) ShowImg(b ...bool) *Entity
- func (this *Entity) ShowWindow(b ...bool) *Entity
- func (this *Entity) WebDriver() (*WebDriver, error)
- type Error
- type FrameBuffer
- type FrameBufferOptions
- type KeyAction
- type MouseButton
- type Option
- type Point
- type PointerAction
- type PointerMoveOrigin
- type PointerType
- type Proxy
- type ProxyType
- type SameSite
- type Service
- type ServiceOption
- func ChromeDriver(path string) ServiceOption
- func Display(d, xauthPath string) ServiceOption
- func GeckoDriver(path string) ServiceOption
- func HTMLUnit(path string) ServiceOption
- func JavaPath(path string) ServiceOption
- func Output(w io.Writer) ServiceOption
- func StartFrameBuffer() ServiceOption
- func StartFrameBufferWithOptions(options FrameBufferOptions) ServiceOption
- type Size
- type Status
- type WebDriver
- func (wd *WebDriver) AcceptAlert() error
- func (wd *WebDriver) ActiveElement() (*WebElement, error)
- func (wd *WebDriver) AddCookie(cookie *Cookie) error
- func (wd *WebDriver) AlertText() (string, error)
- func (wd *WebDriver) Back() error
- func (wd *WebDriver) ButtonDown() error
- func (wd *WebDriver) ButtonUp() error
- func (wd *WebDriver) Capabilities() (Capabilities, error)
- func (wd *WebDriver) Click(button int) error
- func (wd *WebDriver) Close() error
- func (wd *WebDriver) CloseWindow(name string) error
- func (this *WebDriver) Copy() *WebDriver
- func (wd *WebDriver) CurrentURL() (string, error)
- func (wd *WebDriver) CurrentWindowHandle() (string, error)
- func (wd *WebDriver) DecodeElement(data []byte) (*WebElement, error)
- func (wd *WebDriver) DecodeElements(data []byte) ([]*WebElement, error)
- func (wd *WebDriver) DeleteAllCookies() error
- func (wd *WebDriver) DeleteCookie(name string) error
- func (wd *WebDriver) DismissAlert() error
- func (wd *WebDriver) DoubleClick() error
- func (wd *WebDriver) ExecuteScript(script string, args []interface{}) (interface{}, error)
- func (wd *WebDriver) ExecuteScriptAsync(script string, args []interface{}) (interface{}, error)
- func (wd *WebDriver) ExecuteScriptAsyncRaw(script string, args []interface{}) ([]byte, error)
- func (wd *WebDriver) ExecuteScriptRaw(script string, args []interface{}) ([]byte, error)
- func (this *WebDriver) Find(by, value string) (*WebElement, error)
- func (this *WebDriver) FindAll(by, value string) ([]*WebElement, error)
- func (wd *WebDriver) FindElement(by, value string) (*WebElement, error)
- func (wd *WebDriver) FindElements(by, value string) ([]*WebElement, error)
- func (this *WebDriver) FindTag(tag string) (*WebElement, error)
- func (this *WebDriver) FindTagAttributes(tag string) ([]string, error)
- func (this *WebDriver) FindTags(tag string) ([]*WebElement, error)
- func (wd *WebDriver) Forward() error
- func (wd *WebDriver) Get(url string) error
- func (wd *WebDriver) GetCookie(name string) (Cookie, error)
- func (wd *WebDriver) GetCookies() ([]Cookie, error)
- func (wd *WebDriver) KeyDown(keys string) error
- func (wd *WebDriver) KeyUp(keys string) error
- func (wd *WebDriver) Log(typ log.Type) ([]log.Message, error)
- func (wd *WebDriver) MaximizeWindow(name string) error
- func (wd *WebDriver) MinimizeWindow(name string) error
- func (wd *WebDriver) NewSession() (string, error)
- func (wd *WebDriver) PageSource() (string, error)
- func (wd *WebDriver) PerformActions() error
- func (wd *WebDriver) Quit() error
- func (this *WebDriver) RangeTags(tag string, f func(*WebElement) error) error
- func (wd *WebDriver) Refresh() error
- func (wd *WebDriver) ReleaseActions() error
- func (wd *WebDriver) ResizeWindow(name string, width, height int) error
- func (wd *WebDriver) SaveScreenshot(filename string) error
- func (wd *WebDriver) Screenshot() ([]byte, error)
- func (wd *WebDriver) SendModifier(modifier string, isDown bool) error
- func (wd *WebDriver) SessionID() string
- func (wd *WebDriver) SetAlertText(text string) error
- func (wd *WebDriver) SetAsyncScriptTimeout(timeout time.Duration) error
- func (wd *WebDriver) SetImplicitWaitTimeout(timeout time.Duration) error
- func (wd *WebDriver) SetPageLoadTimeout(timeout time.Duration) error
- func (wd *WebDriver) Status() (*Status, error)
- func (wd *WebDriver) StoreKeyActions(inputID string, actions ...KeyAction)
- func (wd *WebDriver) StorePointerActions(inputID string, pointer PointerType, actions ...PointerAction)
- func (wd *WebDriver) SwitchFrame(frame interface{}) error
- func (wd *WebDriver) SwitchWindow(name string) error
- func (wd *WebDriver) Text() (string, error)
- func (wd *WebDriver) Title() (string, error)
- func (wd *WebDriver) Wait(condition Condition) error
- func (this WebDriver) WaitMinute(n ...int)
- func (this WebDriver) WaitSecond(n ...int)
- func (wd *WebDriver) WaitWithTimeout(condition Condition, timeout time.Duration) error
- func (wd *WebDriver) WaitWithTimeoutAndInterval(condition Condition, timeout, interval time.Duration) error
- func (wd *WebDriver) WindowHandles() ([]string, error)
- type WebElement
- func (elem *WebElement) CSSProperty(name string) (string, error)
- func (elem *WebElement) Clear() error
- func (elem *WebElement) Click() error
- func (elem *WebElement) FindElement(by, value string) (*WebElement, error)
- func (elem *WebElement) FindElements(by, value string) ([]*WebElement, error)
- func (elem *WebElement) GetAttribute(name string) (string, error)
- func (elem *WebElement) GetProperty(name string) (string, error)
- func (elem *WebElement) IsDisplayed() (bool, error)
- func (elem *WebElement) IsEnabled() (bool, error)
- func (elem *WebElement) IsSelected() (bool, error)
- func (elem *WebElement) Location() (*Point, error)
- func (elem *WebElement) LocationInView() (*Point, error)
- func (elem *WebElement) MarshalJSON() ([]byte, error)
- func (elem *WebElement) MoveTo(xOffset, yOffset int) error
- func (elem *WebElement) SaveScreenshot(filename string) error
- func (elem *WebElement) Screenshot() ([]byte, error)
- func (elem *WebElement) SendKeys(keys string) error
- func (elem *WebElement) Size() (*Size, error)
- func (elem *WebElement) Submit() error
- func (elem *WebElement) TagName() (string, error)
- func (elem *WebElement) Text() (string, error)
- func (WebElement) Wait(t time.Duration)
- func (this WebElement) WaitMinute(n ...int)
- func (this WebElement) WaitSecond(n ...int)
Constants ¶
const ( // DefaultURLPrefix is the default HTTP endpoint that offers the WebDriver API. DefaultURLPrefix = "http://127.0.0.1:4444/wd/hub" // DefaultWaitInterval is the default polling interval for selenium.Wait // function. DefaultWaitInterval = 100 * time.Millisecond // DefaultWaitTimeout is the default timeout for selenium.Wait function. DefaultWaitTimeout = 60 * time.Second )
const ( ByID = "id" ByXPATH = "xpath" ByLinkText = "link text" ByPartialLinkText = "partial link text" ByName = "name" ByTagName = "tag name" ByClassName = "class name" ByCSSSelector = "css selector" )
Methods by which to find elements.
const ( NullKey = string('\ue000') CancelKey = string('\ue001') HelpKey = string('\ue002') BackspaceKey = string('\ue003') TabKey = string('\ue004') ClearKey = string('\ue005') ReturnKey = string('\ue006') EnterKey = string('\ue007') ShiftKey = string('\ue008') ControlKey = string('\ue009') AltKey = string('\ue00a') PauseKey = string('\ue00b') EscapeKey = string('\ue00c') SpaceKey = string('\ue00d') PageUpKey = string('\ue00e') PageDownKey = string('\ue00f') EndKey = string('\ue010') HomeKey = string('\ue011') LeftArrowKey = string('\ue012') UpArrowKey = string('\ue013') RightArrowKey = string('\ue014') DownArrowKey = string('\ue015') InsertKey = string('\ue016') DeleteKey = string('\ue017') SemicolonKey = string('\ue018') EqualsKey = string('\ue019') Numpad0Key = string('\ue01a') Numpad1Key = string('\ue01b') Numpad2Key = string('\ue01c') Numpad3Key = string('\ue01d') Numpad4Key = string('\ue01e') Numpad5Key = string('\ue01f') Numpad6Key = string('\ue020') Numpad7Key = string('\ue021') Numpad8Key = string('\ue022') Numpad9Key = string('\ue023') MultiplyKey = string('\ue024') AddKey = string('\ue025') SeparatorKey = string('\ue026') SubstractKey = string('\ue027') DecimalKey = string('\ue028') DivideKey = string('\ue029') F1Key = string('\ue031') F2Key = string('\ue032') F3Key = string('\ue033') F4Key = string('\ue034') F5Key = string('\ue035') F6Key = string('\ue036') F7Key = string('\ue037') F8Key = string('\ue038') F9Key = string('\ue039') F10Key = string('\ue03a') F11Key = string('\ue03b') F12Key = string('\ue03c') MetaKey = string('\ue03d') )
Special keyboard keys, for SendKeys.
const ( // Direct connection - no proxy in use. Direct ProxyType = "direct" // Manual proxy settings configured, e.g. setting a proxy for HTTP, a proxy // for FTP, etc. Manual = "manual" // Autodetect proxy, probably with WPAD Autodetect = "autodetect" // System settings used. System = "system" // PAC - Proxy autoconfiguration from a URL. PAC = "pac" )
const ( MousePointer PointerType = "mouse" PenPointer = "pen" TouchPointer = "touch" )
Variables ¶
var HTTPClient = &http.Client{}
HTTPClient is the default client to use to communicate with the WebDriver server.
Functions ¶
func DeleteSession ¶
DeleteSession deletes an existing session at the WebDriver instance specified by the urlPrefix and the session ID.
Types ¶
type Actions ¶
type Actions []map[string]interface{}
Actions stores KeyActions and PointerActions for later execution.
type Capabilities ¶
type Capabilities map[string]interface{}
Capabilities configures both the WebDriver process and the target browsers, with standard and browser-specific options.
func (Capabilities) AddChrome ¶
func (c Capabilities) AddChrome(f chrome.Capabilities)
AddChrome adds Chrome-specific capabilities.
func (Capabilities) AddFirefox ¶
func (c Capabilities) AddFirefox(f firefox.Capabilities)
AddFirefox adds Firefox-specific capabilities.
func (Capabilities) AddLogging ¶
func (c Capabilities) AddLogging(l log.Capabilities)
AddLogging adds logging configuration to the capabilities.
func (Capabilities) AddProxy ¶
func (c Capabilities) AddProxy(p Proxy)
AddProxy adds proxy configuration to the capabilities.
func (Capabilities) SetLogLevel ¶
func (c Capabilities) SetLogLevel(typ log.Type, level log.Level)
SetLogLevel sets the logging level of a component. It is a shortcut for passing a log.Capabilities instance to AddLogging.
type Condition ¶
Condition is an alias for a type that is passed as an argument for selenium.Wait(cond Condition) (error) function.
type Cookie ¶
type Cookie struct { Name string `json:"name"` Value string `json:"value"` Path string `json:"path"` Domain string `json:"domain"` Secure bool `json:"secure"` Expiry uint `json:"expiry"` HTTPOnly bool `json:"httpOnly"` SameSite SameSite `json:"sameSite,omitempty"` }
Cookie represents an HTTP cookie.
type Entity ¶
type Entity struct { *Service Prefs map[string]interface{} Args []string // contains filtered or unexported fields }
func (*Entity) AddArgument ¶
func (*Entity) DelArgument ¶
func (*Entity) SetBrowser ¶
SetBrowser 设置浏览器,目前只测试了chrome
func (*Entity) SetBrowserPath ¶
SetBrowserPath 设置浏览器目录
func (*Entity) SetUserAgent ¶
SetUserAgent 设置UserAgent
func (*Entity) SetUserAgentDefault ¶
SetUserAgentDefault 设置UserAgent到默认值
func (*Entity) SetUserAgentRand ¶
SetUserAgentRand 设置随机UserAgent
func (*Entity) ShowWindow ¶
ShowWindow 显示窗口linux系统无效
type Error ¶
type Error struct { // Err contains a general error string provided by the server. Err string `json:"error"` // Message is a detailed, human-readable message specific to the failure. Message string `json:"message"` // Stacktrace may contain the server-side stacktrace where the error occurred. Stacktrace string `json:"stacktrace"` // HTTPCode is the HTTP status code returned by the server. HTTPCode int // LegacyCode is the "Response Status Code" defined in the legacy Selenium // WebDriver JSON wire protocol. This code is only produced by older // Selenium WebDriver versions, Chromedriver, and InternetExplorerDriver. LegacyCode int }
Error contains information about a failure of a command. See the table of these strings at https://www.w3.org/TR/webdriver/#handling-errors .
This error type is only returned by servers that implement the W3C specification.
type FrameBuffer ¶
type FrameBuffer struct { // Display is the X11 display number that the Xvfb process is hosting // (without the preceding colon). Display string // AuthPath is the path to the X11 authorization file that permits X clients // to use the X server. This is typically provided to the client via the // XAUTHORITY environment variable. AuthPath string // contains filtered or unexported fields }
FrameBuffer controls an X virtual frame buffer running as a background process.
func NewFrameBuffer ¶
func NewFrameBuffer() (*FrameBuffer, error)
NewFrameBuffer starts an X virtual frame buffer running in the background.
This is equivalent to calling NewFrameBufferWithOptions with an empty NewFrameBufferWithOptions.
func NewFrameBufferWithOptions ¶
func NewFrameBufferWithOptions(options FrameBufferOptions) (*FrameBuffer, error)
NewFrameBufferWithOptions starts an X virtual frame buffer running in the background. FrameBufferOptions may be populated to change the behavior of the frame buffer.
func (FrameBuffer) Stop ¶
func (f FrameBuffer) Stop() error
Stop kills the background frame buffer process and removes the X authorization file.
type FrameBufferOptions ¶
type FrameBufferOptions struct { // ScreenSize is the option for the frame buffer screen size. // This is of the form "{width}x{height}[x{depth}]". For example: "1024x768x24" ScreenSize string }
FrameBufferOptions describes the options that can be used to create a frame buffer.
type KeyAction ¶
type KeyAction map[string]interface{}
KeyAction represents an activity involving a keyboard key.
func KeyDownAction ¶
KeyDownAction builds a KeyAction which presses and holds the specified key.
func KeyPauseAction ¶
KeyPauseAction builds a KeyAction which pauses for the supplied duration.
type MouseButton ¶
type MouseButton int
const ( LeftButton MouseButton = iota MiddleButton RightButton )
Mouse buttons.
type PointerAction ¶
type PointerAction map[string]interface{}
PointerAction represents an activity involving a pointer.
func PointerDownAction ¶
func PointerDownAction(button MouseButton) PointerAction
PointerDownAction PointerDown builds a PointerAction which presses and holds the specified pointer key.
func PointerMoveAction ¶
func PointerMoveAction(duration time.Duration, offset Point, origin PointerMoveOrigin) PointerAction
PointerMoveAction PointerMove builds a PointerAction which moves the pointer.
func PointerPauseAction ¶
func PointerPauseAction(duration time.Duration) PointerAction
PointerPauseAction PointerPause builds a PointerAction which pauses for the supplied duration.
func PointerUpAction ¶
func PointerUpAction(button MouseButton) PointerAction
PointerUpAction PointerUp builds an action which releases the specified pointer key.
type PointerMoveOrigin ¶
type PointerMoveOrigin string
PointerMoveOrigin controls how the offset for the pointer move action is calculated.
const ( // FromViewport calculates the offset from the viewport at 0,0. FromViewport PointerMoveOrigin = "viewport" // FromPointer calculates the offset from the current pointer position. FromPointer = "pointer" )
type PointerType ¶
type PointerType string
PointerType is the type of pointer used by StorePointerActions. There are 3 different types according to the WC3 implementation.
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"` SOCKSVersion int `json:"socksVersion,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.
type ProxyType ¶
type ProxyType string
ProxyType is an enumeration of the types of proxies available.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service controls a locally-running Selenium subprocess.
func NewChromeDriverService ¶
func NewChromeDriverService(path string, port int, opts ...ServiceOption) (*Service, error)
NewChromeDriverService starts a ChromeDriver instance in the background.
func NewGeckoDriverService ¶
func NewGeckoDriverService(path string, port int, opts ...ServiceOption) (*Service, error)
NewGeckoDriverService starts a GeckoDriver instance in the background.
func NewSeleniumService ¶
func NewSeleniumService(jarPath string, port int, opts ...ServiceOption) (*Service, error)
NewSeleniumService starts a Selenium instance in the background.
func (*Service) FrameBuffer ¶
func (s *Service) FrameBuffer() *FrameBuffer
FrameBuffer returns the FrameBuffer if one was started by the service and nil otherwise.
type ServiceOption ¶
ServiceOption configures a Service instance.
func ChromeDriver ¶
func ChromeDriver(path string) ServiceOption
ChromeDriver sets the path for Chromedriver for the Selenium Server. This ServiceOption is only useful when calling NewSeleniumService.
func Display ¶
func Display(d, xauthPath string) ServiceOption
Display specifies the value to which set the DISPLAY environment variable, as well as the path to the Xauthority file containing credentials needed to write to that X server.
func GeckoDriver ¶
func GeckoDriver(path string) ServiceOption
GeckoDriver sets the path to the geckodriver binary for the Selenium Server. Unlike other drivers, Selenium Server does not support specifying the geckodriver path at runtime. This ServiceOption is only useful when calling NewSeleniumService.
func HTMLUnit ¶
func HTMLUnit(path string) ServiceOption
HTMLUnit specifies the path to the JAR for the HTMLUnit driver (compiled with its dependencies).
func Output ¶
func Output(w io.Writer) ServiceOption
Output specifies that the WebDriver service should log to the provided writer.
func StartFrameBuffer ¶
func StartFrameBuffer() ServiceOption
StartFrameBuffer causes an X virtual frame buffer to start before the WebDriver service. The frame buffer process will be terminated when the service itself is stopped.
This is equivalent to calling StartFrameBufferWithOptions with an empty map.
func StartFrameBufferWithOptions ¶
func StartFrameBufferWithOptions(options FrameBufferOptions) ServiceOption
StartFrameBufferWithOptions causes an X virtual frame buffer to start before the WebDriver service. The frame buffer process will be terminated when the service itself is stopped.
type Status ¶
type Status struct { // The following fields are used by Selenium and ChromeDriver. Java struct { Version string } Build struct { Version, Revision, Time string } OS struct { Arch, Name, Version string } // The following fields are specified by the W3C WebDriver specification and // are used by GeckoDriver. Ready bool Message string }
Status contains information returned by the Status method.
type WebDriver ¶
type WebDriver struct {
// contains filtered or unexported fields
}
func NewRemote ¶
func NewRemote(capabilities Capabilities, urlPrefix string) (*WebDriver, error)
NewRemote creates new remote client, this will also start a new session. capabilities provides the desired capabilities. urlPrefix is the URL to the Selenium server, must be prefixed with protocol (http, https, ...).
Providing an empty string for urlPrefix causes the DefaultURLPrefix to be used.
func (*WebDriver) AcceptAlert ¶
func (*WebDriver) ActiveElement ¶
func (wd *WebDriver) ActiveElement() (*WebElement, error)
func (*WebDriver) ButtonDown ¶
ButtonDown TODO(minusnine): add a test for ButtonDown.
func (*WebDriver) Capabilities ¶
func (wd *WebDriver) Capabilities() (Capabilities, error)
func (*WebDriver) CloseWindow ¶
func (*WebDriver) CurrentURL ¶
func (*WebDriver) CurrentWindowHandle ¶
func (*WebDriver) DecodeElement ¶
func (wd *WebDriver) DecodeElement(data []byte) (*WebElement, error)
func (*WebDriver) DecodeElements ¶
func (wd *WebDriver) DecodeElements(data []byte) ([]*WebElement, error)
func (*WebDriver) DeleteAllCookies ¶
func (*WebDriver) DeleteCookie ¶
func (*WebDriver) DismissAlert ¶
func (*WebDriver) DoubleClick ¶
DoubleClick TODO(minusnine): add a test for DoubleClick.
func (*WebDriver) ExecuteScript ¶
func (*WebDriver) ExecuteScriptAsync ¶
func (*WebDriver) ExecuteScriptAsyncRaw ¶
func (*WebDriver) ExecuteScriptRaw ¶
func (*WebDriver) Find ¶
func (this *WebDriver) Find(by, value string) (*WebElement, error)
Find 查找一个元素
func (*WebDriver) FindAll ¶
func (this *WebDriver) FindAll(by, value string) ([]*WebElement, error)
FindAll 查找所有元素
func (*WebDriver) FindElement ¶
func (wd *WebDriver) FindElement(by, value string) (*WebElement, error)
func (*WebDriver) FindElements ¶
func (wd *WebDriver) FindElements(by, value string) ([]*WebElement, error)
func (*WebDriver) FindTag ¶
func (this *WebDriver) FindTag(tag string) (*WebElement, error)
FindTag 查找标签,例如a标签
func (*WebDriver) FindTagAttributes ¶
FindTagAttributes 查找所有标签的属性Attribute,例如a.href
func (*WebDriver) FindTags ¶
func (this *WebDriver) FindTags(tag string) ([]*WebElement, error)
FindTags 查找所有标签,例如a标签,href在a标签里面
func (*WebDriver) GetCookies ¶
func (*WebDriver) MaximizeWindow ¶
func (*WebDriver) MinimizeWindow ¶
func (*WebDriver) NewSession ¶
func (*WebDriver) PageSource ¶
func (*WebDriver) PerformActions ¶
func (*WebDriver) RangeTags ¶
func (this *WebDriver) RangeTags(tag string, f func(*WebElement) error) error
RangeTags 遍历标签,例如a标签
func (*WebDriver) ReleaseActions ¶
func (*WebDriver) ResizeWindow ¶
func (*WebDriver) SaveScreenshot ¶
SaveScreenshot 保存截图
func (*WebDriver) SendModifier ¶
func (*WebDriver) SetAlertText ¶
func (*WebDriver) SetAsyncScriptTimeout ¶
func (*WebDriver) SetImplicitWaitTimeout ¶
func (*WebDriver) SetPageLoadTimeout ¶
func (*WebDriver) StoreKeyActions ¶
func (*WebDriver) StorePointerActions ¶
func (wd *WebDriver) StorePointerActions(inputID string, pointer PointerType, actions ...PointerAction)
func (*WebDriver) SwitchFrame ¶
func (*WebDriver) SwitchWindow ¶
func (WebDriver) WaitMinute ¶
func (this WebDriver) WaitMinute(n ...int)
func (WebDriver) WaitSecond ¶
func (this WebDriver) WaitSecond(n ...int)
func (*WebDriver) WaitWithTimeout ¶
func (*WebDriver) WaitWithTimeoutAndInterval ¶
func (*WebDriver) WindowHandles ¶
type WebElement ¶
type WebElement struct {
// contains filtered or unexported fields
}
func (*WebElement) CSSProperty ¶
func (elem *WebElement) CSSProperty(name string) (string, error)
func (*WebElement) Clear ¶
func (elem *WebElement) Clear() error
func (*WebElement) Click ¶
func (elem *WebElement) Click() error
func (*WebElement) FindElement ¶
func (elem *WebElement) FindElement(by, value string) (*WebElement, error)
func (*WebElement) FindElements ¶
func (elem *WebElement) FindElements(by, value string) ([]*WebElement, error)
func (*WebElement) GetAttribute ¶
func (elem *WebElement) GetAttribute(name string) (string, error)
func (*WebElement) GetProperty ¶
func (elem *WebElement) GetProperty(name string) (string, error)
func (*WebElement) IsDisplayed ¶
func (elem *WebElement) IsDisplayed() (bool, error)
func (*WebElement) IsEnabled ¶
func (elem *WebElement) IsEnabled() (bool, error)
func (*WebElement) IsSelected ¶
func (elem *WebElement) IsSelected() (bool, error)
func (*WebElement) Location ¶
func (elem *WebElement) Location() (*Point, error)
func (*WebElement) LocationInView ¶
func (elem *WebElement) LocationInView() (*Point, error)
func (*WebElement) MarshalJSON ¶
func (elem *WebElement) MarshalJSON() ([]byte, error)
func (*WebElement) MoveTo ¶
func (elem *WebElement) MoveTo(xOffset, yOffset int) error
func (*WebElement) SaveScreenshot ¶
func (elem *WebElement) SaveScreenshot(filename string) error
func (*WebElement) Screenshot ¶
func (elem *WebElement) Screenshot() ([]byte, error)
func (*WebElement) SendKeys ¶
func (elem *WebElement) SendKeys(keys string) error
func (*WebElement) Size ¶
func (elem *WebElement) Size() (*Size, error)
func (*WebElement) Submit ¶
func (elem *WebElement) Submit() error
func (*WebElement) TagName ¶
func (elem *WebElement) TagName() (string, error)
func (*WebElement) Text ¶
func (elem *WebElement) Text() (string, error)
func (WebElement) WaitMinute ¶
func (this WebElement) WaitMinute(n ...int)
func (WebElement) WaitSecond ¶
func (this WebElement) WaitSecond(n ...int)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package chrome provides Chrome-specific options for WebDriver.
|
Package chrome provides Chrome-specific options for WebDriver. |
Package firefox provides Firefox-specific types for WebDriver.
|
Package firefox provides Firefox-specific types for WebDriver. |
internal
|
|
seleniumtest
Package seleniumtest provides tests to exercise package selenium.
|
Package seleniumtest provides tests to exercise package selenium. |
zip
Package zip creates Zip files.
|
Package zip creates Zip files. |
Package log provides logging-related configuration types and constants.
|
Package log provides logging-related configuration types and constants. |
Package sauce interacts with the Sauce Labs hosted browser testing environment.
|
Package sauce interacts with the Sauce Labs hosted browser testing environment. |