go-selenium: github.com/bunsenapp/go-selenium Index | Files

package goselenium

import "github.com/bunsenapp/go-selenium"

Package goselenium is a Selenium web driver library written in Go.

Index

Package Files

api_service.go capabilities.go doc.go errors.go remote_driver.go remote_driver_alert.go remote_driver_command.go remote_driver_cookie.go remote_driver_document.go remote_driver_element.go remote_driver_helpers.go remote_driver_navigation.go remote_driver_screenshot.go remote_driver_session.go remote_element.go web_driver.go

Constants

const (
    UnidentifiedKey   = 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')
    ArrowLeftKey      = string('\uE012')
    ArrowUpKey        = string('\uE013')
    ArrowRightKey     = string('\uE014')
    ArrowDownKey      = string('\uE015')
    InsertKey         = string('\uE016')
    DeleteKey         = string('\uE017')
    SemiColonKey      = string('\uE018')
    EqualsKey         = string('\uE019')
    AsteriskKey       = string('\uE024')
    PlusKey           = string('\uE025')
    CommaKey          = string('\uE026')
    MinusKey          = string('\uE027')
    PeriodKey         = string('\uE028')
    ForwardSlashKey   = 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')
    ZenkakuHankakuKey = string('\uE040')
)

Keyboard keys converted from the ASCII code.

const (
    ElementNotSelectable   = "element not selectable"
    ElementNotInteractable = "element not interactable"
    InsecureCertificate    = "insecure certificate"
    InvalidArgument        = "invalid argument"
    InvalidCookieDomain    = "invalid cookie domain"
    InvalidCoordinates     = "invalid coordinates"
    InvalidElementState    = "invalid element state"
    InvalidSelector        = "invalid selector"
    InvalidSessionID       = "invalid session id"
    JavascriptError        = "javascript error"
    MoveTargetOutOfBounds  = "move target out of bounds"
    NoSuchAlert            = "no such alert"
    NoSuchCookie           = "no such cookie"
    NoSuchElement          = "no such element"
    NoSuchFrame            = "no such frame"
    NoSuchWindow           = "no such window"
    ScriptTimeout          = "script timeout"
    SessionNotCreated      = "session not created"
    StaleElementReference  = "stale element reference"
    TimeoutError           = "timeout"
    UnableToSetCookie      = "unable to set cookie"
    UnableToCaptureScreen  = "unable to capture screen"
    UnexpectedAlertOpen    = "unexpected alert open"
    UnknownCommand         = "unknown command"
    UnknownError           = "unknown error"
    UnknownMethod          = "unknown method"
    UnsupportedOperation   = "unsupported operation"
)

Error codes that are returned from Selenium. Infer that the type of the error returned is CommunicationError, then do a comparison on the err.Response.State field to one of the below constants.

func IsCommunicationError Uses

func IsCommunicationError(err error) bool

IsCommunicationError checks whether an error is a selenium communication error.

func IsInvalidURLError Uses

func IsInvalidURLError(err error) bool

IsInvalidURLError checks whether an error is due to the URL being incorrectly formatted.

func IsMarshallingError Uses

func IsMarshallingError(err error) bool

IsMarshallingError checks whether an error is a marshalling error.

func IsSessionIDError Uses

func IsSessionIDError(err error) bool

IsSessionIDError checks whether an error is due to a session ID not being set.

func IsUnmarshallingError Uses

func IsUnmarshallingError(err error) bool

IsUnmarshallingError checks whether an error is a selenium unmarshalling error.

type AcceptAlertResponse Uses

type AcceptAlertResponse struct {
    State string
}

AcceptAlertResponse is the response returned from calling the AcceptAlert method.

type AddCookieResponse Uses

type AddCookieResponse struct {
    State string
}

AddCookieResponse is the result returned from calling the AddCookie method.

type AlertTextResponse Uses

type AlertTextResponse struct {
    State string
    Text  string
}

AlertTextResponse is the response returned from calling the AlertText method.

type AllCookiesResponse Uses

type AllCookiesResponse struct {
    State   string   `json:"state"`
    Cookies []Cookie `json:"value"`
}

AllCookiesResponse is the response returned from the AllCookies method.

type BackResponse Uses

type BackResponse struct {
    State string
}

BackResponse is the response returned from the Back call.

type Browser Uses

type Browser interface {
    BrowserName() string
}

Browser defines a supported selenium enabled browser.

func AndroidBrowser Uses

func AndroidBrowser() Browser

AndroidBrowser returns an Android browser object.

func ChromeBrowser Uses

func ChromeBrowser() Browser

ChromeBrowser returns a Chrome browser object.

func FirefoxBrowser Uses

func FirefoxBrowser() Browser

FirefoxBrowser returns a Firefox browser object.

func HTMLUnitBrowser Uses

func HTMLUnitBrowser() Browser

HTMLUnitBrowser returns a HTMLUnit browser object.

func IPadBrowser Uses

func IPadBrowser() Browser

IPadBrowser returns an IPad browser object.

func IPhoneBrowser Uses

func IPhoneBrowser() Browser

IPhoneBrowser returns an IPhone browser object.

func InternetExplorerBrowser Uses

func InternetExplorerBrowser() Browser

InternetExplorerBrowser returns an IE browser object.

func OperaBrowser Uses

func OperaBrowser() Browser

OperaBrowser returns an Opera browser object.

func SafariBrowser Uses

func SafariBrowser() Browser

SafariBrowser returns a Safari browser object.

type By Uses

type By interface {
    // Type is the type of by (i.e. id, xpath, class, name, index).
    Type() string

    // Value is the actual value to retrieve something by (i.e. #test, 1).
    Value() interface{}
}

By is an interface that defines what all 'ByX' methods must return.

func ByCSSSelector Uses

func ByCSSSelector(selector string) By

ByCSSSelector accepts a CSS selector (i.e. ul#id > a) for use in the FindElement(s) functions.

func ByIndex Uses

func ByIndex(index uint) By

ByIndex accepts an integer that represents what the index of an element is and returns the appropriate By implementation.

func ByLinkText Uses

func ByLinkText(text string) By

ByLinkText is used to find an anchor element by its innerText.

func ByPartialLinkText Uses

func ByPartialLinkText(text string) By

ByPartialLinkText works the same way as ByLinkText but performs a search where the link text contains the string passed in instead of a full match.

func ByXPath Uses

func ByXPath(path string) By

ByXPath utilises the xpath to find elements (see http://www.guru99.com/xpath-selenium.html).

type Capabilities Uses

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

Capabilities represents the capabilities defined in the W3C specification. The main capability is the browser, which can be set by calling one of the \wBrowser\(\) methods.

func (*Capabilities) Browser Uses

func (c *Capabilities) Browser() Browser

Browser yields the browser capability assigned to the current Capabilities object..

func (*Capabilities) SetBrowser Uses

func (c *Capabilities) SetBrowser(b Browser)

SetBrowser sets the browser capability to be one of the allowed browsers.

type CloseWindowResponse Uses

type CloseWindowResponse struct {
    State   string   `json:"state"`
    Handles []string `json:"value"`
}

CloseWindowResponse is the response returned from the CloseWindow() method. As per the W3C specification, it yields all of the available window handles minus the active one that closes as a result of the CloseWindow() call.

type CommunicationError Uses

type CommunicationError struct {
    Response *ErrorResponse
    // contains filtered or unexported fields
}

CommunicationError is the result of a communication failure between this library and the WebDriver API.

func (CommunicationError) Error Uses

func (c CommunicationError) Error() string

Error returns a formatted communication error string.

type Cookie struct {
    Name       string `json:"name"`
    Value      string `json:"value"`
    Path       string `json:"path"`
    Domain     string `json:"domain"`
    SecureOnly bool   `json:"secure"`
    HTTPOnly   bool   `json:"httpOnly"`
}

Cookie represents a browser cookie.

type CookieResponse Uses

type CookieResponse struct {
    State  string `json:"state"`
    Cookie Cookie `json:"value"`
}

CookieResponse is the response returned from the Cookie method.

type CreateSessionCapabilities Uses

type CreateSessionCapabilities struct {
    AcceptInsecureCerts bool   `json:"acceptSslCerts"`
    BrowserName         string `json:"browserName"`
    BrowserVersion      string `json:"browserVersion"`
    PlatformName        string `json:"platformVersion"`
}

CreateSessionCapabilities is a summarisation of the capabilities returned from the CreateSession method.

type CreateSessionResponse Uses

type CreateSessionResponse struct {
    Capabilities CreateSessionCapabilities `json:"value"`
    SessionID    string                    `json:"sessionId"`
}

CreateSessionResponse is the response returned from the API when the CreateSession() method does not throw an error.

type CurrentURLResponse Uses

type CurrentURLResponse struct {
    State string
    URL   string
}

CurrentURLResponse is the response returned from the GET Url call.

type DeleteCookieResponse Uses

type DeleteCookieResponse struct {
    State string
}

DeleteCookieResponse is the result returned from calling the DeleteCookie method.

type DeleteSessionResponse Uses

type DeleteSessionResponse struct {
    State     string `json:"state"`
    SessionID string `json:"sessionId"`
}

DeleteSessionResponse is the response returned from the API when the DeleteSession() method does not thrown an error.

type Dimensions Uses

type Dimensions struct {
    Width  uint `json:"width"`
    Height uint `json:"height"`
}

Dimensions is a type that is both returned and accept by functions. It is usually only used for the window size components.

type DismissAlertResponse Uses

type DismissAlertResponse struct {
    State string
}

DismissAlertResponse is the response returned from calling the DismissAlert method.

type Element Uses

type Element interface {
    // ID is the assigned ID for the element returned from the Selenium driver.
    ID() string

    // Selected gets whether or not the current element is selected. This only
    // makes sense for inputs such as radio buttons and checkboxes.
    Selected() (*ElementSelectedResponse, error)

    // Attribute retrieves an attribute (i.e. href, class) of the current
    // active element.
    Attribute(att string) (*ElementAttributeResponse, error)

    // CSSValue retrieves a CSS property associated with the current element.
    // As an example, this could be the 'background' or 'font-family' properties.
    CSSValue(prop string) (*ElementCSSValueResponse, error)

    // Text gets the value of element.innerText for the current element.
    Text() (*ElementTextResponse, error)

    // TagName gets the HTML element name (i.e. p, div) of the currently selected
    // element.
    TagName() (*ElementTagNameResponse, error)

    // Rectangle gets the dimensions and co-ordinates of the currently selected
    // element.
    Rectangle() (*ElementRectangleResponse, error)

    // Enabled gets whether or not the current selected elemented is enabled.
    Enabled() (*ElementEnabledResponse, error)

    // Click clicks the currently selected element. Please note, you may have to
    // implement your own wait to ensure the page actually navigates. This is due to
    // Selenium having no idea whether or not your click will be interrupted by JS.
    // Alternatively, you can use the WaitUntil(TitleEquals("title"), 20) to
    // automatically wait until the page title has changed.
    Click() (*ElementClickResponse, error)

    // Clear clears the currently selected element according to the specification.
    Clear() (*ElementClearResponse, error)

    // SendKeys sends a set of keystrokes to the currently selected element.
    SendKeys(keys string) (*ElementSendKeysResponse, error)
}

Element is an interface which specifies what all WebDriver elements must do. Any requests which involve this element (i.e. FindElements that are children of the current element) will be specified. Anything not related will exist within the WebDriver interface/implementation.

type ElementAttributeResponse Uses

type ElementAttributeResponse struct {
    State string
    Value string
}

ElementAttributeResponse is the response returned from the Attribute call.

type ElementCSSValueResponse Uses

type ElementCSSValueResponse struct {
    State string
    Value string
}

ElementCSSValueResponse is the response returned when the CSSValue method is called on an Element implementation.

type ElementClearResponse Uses

type ElementClearResponse struct {
    State string
}

ElementClearResponse is the response returned from calling the Clear method.

type ElementClickResponse Uses

type ElementClickResponse struct {
    State string
}

ElementClickResponse is the response returned from calling the Click method.

type ElementEnabledResponse Uses

type ElementEnabledResponse struct {
    State   string `json:"state"`
    Enabled bool   `json:"value"`
}

ElementEnabledResponse is the response returned from calling the Enabled method.

type ElementRectangleResponse Uses

type ElementRectangleResponse struct {
    State     string
    Rectangle Rectangle `json:"value"`
}

ElementRectangleResponse is the response returned from calling the Rectangle method.

type ElementSelectedResponse Uses

type ElementSelectedResponse struct {
    State    string `json:"state"`
    Selected bool   `json:"value"`
}

ElementSelectedResponse is the response returned from the Selected() call. The result /should/ always be successfully returned unless there is a server error.

type ElementSendKeysResponse Uses

type ElementSendKeysResponse struct {
    State string
}

ElementSendKeysResponse is the response returned from calling the SendKeys method.

type ElementTagNameResponse Uses

type ElementTagNameResponse struct {
    State string
    Tag   string
}

ElementTagNameResponse is the response returned from calling the TagName method.

type ElementTextResponse Uses

type ElementTextResponse struct {
    State string
    Text  string
}

ElementTextResponse is the response returned from calling the Text method.

type ErrorResponse Uses

type ErrorResponse struct {
    Message string
    State   string
}

ErrorResponse is what is returned from the Selenium API when an error occurs.

type ExecuteScriptResponse Uses

type ExecuteScriptResponse struct {
    State    string
    Response string
}

ExecuteScriptResponse is the response returned from calling the ExecuteScript method.

type ForwardResponse Uses

type ForwardResponse struct {
    State string
}

ForwardResponse is the response returned from the Forward call.

type GoResponse Uses

type GoResponse struct {
    State string
}

GoResponse is the response returned from the selenium web driver when calling the Go() call. Unfortunately, the W3C specification defines that the response should only be whether the call succeeded or not. Should there be any redirects they will not be catered for in this response. Should you expect any redirects to happen, call the CurrentURL() method.

type InvalidURLError Uses

type InvalidURLError string

InvalidURLError is an error that is returned whenever a URL is not correctly formatted.

func (InvalidURLError) Error Uses

func (i InvalidURLError) Error() string

Error returns the formatted invalid error string.

type MarshallingError Uses

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

MarshallingError is an error that is returned when a json.Marshal error occurs.

func (MarshallingError) Error Uses

func (m MarshallingError) Error() string

Error returns a formatted marshalling error string.

type MaximizeWindowResponse Uses

type MaximizeWindowResponse struct {
    State string
}

MaximizeWindowResponse is the response that is returned from increasing the browser to match the viewport.

type PageSourceResponse Uses

type PageSourceResponse struct {
    State  string
    Source string
}

PageSourceResponse is the response returned from calling the PageSource method.

type Rectangle Uses

type Rectangle struct {
    Dimensions

    X   int `json:"x"`
    Y   int `json:"y"`
}

Rectangle repsents an elements size and position on the page.

type RefreshResponse Uses

type RefreshResponse struct {
    State string
}

RefreshResponse is the response returned from the Refresh call.

type ScreenshotResponse Uses

type ScreenshotResponse struct {
    State        string
    EncodedImage string
}

ScreenshotResponse is the response returned from the Screenshot and ScreenshotElement methods.

func (*ScreenshotResponse) ImageBytes Uses

func (s *ScreenshotResponse) ImageBytes() ([]byte, error)

ImageBytes is a helpful function for decoding the base64 encoded image URL. The image returned is a PNG image and as such can be manipulated by the image/png package. Trying to save this as any other image type will result in it failing to open.

type SendAlertTextResponse Uses

type SendAlertTextResponse struct {
    State string
}

SendAlertTextResponse is the response returned from calling the SendAlertText method.

type SessionIDError Uses

type SessionIDError string

SessionIDError is an error that is returned when the session id is invalid. This value will contain the method that the session error occurred in.

func (SessionIDError) Error Uses

func (s SessionIDError) Error() string

Error returns a formatted session error string.

type SessionStatusResponse Uses

type SessionStatusResponse struct {
    State string
}

SessionStatusResponse is the response returned from the API when the SessionStatus() method is called.

type SetSessionTimeoutResponse Uses

type SetSessionTimeoutResponse struct {
    State string
}

SetSessionTimeoutResponse is the response returned from the API when the SetSessionTimeoutResponse() method is called.

type SetWindowSizeResponse Uses

type SetWindowSizeResponse struct {
    State string
}

SetWindowSizeResponse is the response that is returned from setting the window size of the current top level browsing context.

type SwitchToFrameResponse Uses

type SwitchToFrameResponse struct {
    State string
}

SwitchToFrameResponse is the response returned from the SwitchToFrame() method. For now, according to the specification, it only returns a state.

type SwitchToParentFrameResponse Uses

type SwitchToParentFrameResponse struct {
    State string
}

SwitchToParentFrameResponse represents the response from attempting to switch the top level browsing context to the parent of the current top level browsing context.

type SwitchToWindowResponse Uses

type SwitchToWindowResponse struct {
}

SwitchToWindowResponse is the response returned from the SwitchToWindow() method. You can verify that this result is correct by calling the WindowHandle() method. The two should match.

type Timeout Uses

type Timeout interface {
    // Type is the type of the timeout that is being used.
    Type() string

    // Timeout is the timeout in milliseconds.
    Timeout() int
}

Timeout is an interface which specifies what all timeout requests must follow.

func SessionImplicitWaitTimeout Uses

func SessionImplicitWaitTimeout(to int) Timeout

SessionImplicitWaitTimeout creates an appropriate timeout implementation for the session implicit wait timeout.

func SessionPageLoadTimeout Uses

func SessionPageLoadTimeout(to int) Timeout

SessionPageLoadTimeout creates an appropriate Timeout implementation for the page load timeout.

func SessionScriptTimeout Uses

func SessionScriptTimeout(to int) Timeout

SessionScriptTimeout creates an appropriate Timeout implementation for the script timeout.

type TitleResponse Uses

type TitleResponse struct {
    State string
    Title string
}

TitleResponse is the response returned from the Title call.

type UnmarshallingError Uses

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

UnmarshallingError is the result of an unmarshalling failure of a JSON string.

func (UnmarshallingError) Error Uses

func (u UnmarshallingError) Error() string

Error returns a formatted unmarshalling error string.

type Until Uses

type Until func(w WebDriver) bool

Until represents a function that will be continuously repeated until it succeeds or a timeout is reached.

func UntilElementPresent Uses

func UntilElementPresent(by By) Until

UntilElementPresent attempts to locate an element on the page. It is determined as existing if the state is 'Success' and the error is nil.

func UntilURLIs Uses

func UntilURLIs(url string) Until

UntilURLIs checks whether or not the page's URL has changed.

type WebDriver Uses

type WebDriver interface {

    // DriverURL returns the URL where the W3C compliant web driver is hosted.
    DriverURL() string

    // CreateSession creates a session in the remote driver with the
    // desired capabilities.
    CreateSession() (*CreateSessionResponse, error)

    // DeleteSession deletes the current session associated with the web driver.
    DeleteSession() (*DeleteSessionResponse, error)

    // SessionStatus gets the status about whether a remove end is in a state
    // which it can create new sessions.
    SessionStatus() (*SessionStatusResponse, error)

    // SetSessionTimeout sets a timeout for one of the 3 options.
    // Call SessionScriptTimeout() to generate a script timeout.
    // Call SessionPageLoadTimeout() to generate a page load timeout.
    // Call SessionImplicitWaitTimeout() to generate an implicit wait timeout.
    SetSessionTimeout(to Timeout) (*SetSessionTimeoutResponse, error)

    // Go forces the browser to perform a GET request on a URL.
    Go(url string) (*GoResponse, error)

    // CurrentURL returns the current URL of the top level browsing context.
    CurrentURL() (*CurrentURLResponse, error)

    // Back instructs the web driver to go one step back in the page history.
    Back() (*BackResponse, error)

    // Forward instructs the web driver to go one step forward in the page history.
    Forward() (*ForwardResponse, error)

    // Refresh instructs the web driver to refresh the page that it is currently on.
    Refresh() (*RefreshResponse, error)

    // Title gets the title of the current page of the web driver.
    Title() (*TitleResponse, error)

    // WindowHandle retrieves the current active browsing string for the current session.
    WindowHandle() (*WindowHandleResponse, error)

    // CloseWindow closes the current active window (see WindowHandle() for what
    // window that will be).
    CloseWindow() (*CloseWindowResponse, error)

    // SwitchToWindow switches the current browsing context to a specified window
    // handle.
    SwitchToWindow(handle string) (*SwitchToWindowResponse, error)

    // WindowHandles gets all of the window handles for the current session.
    // To retrieve the currently active window handle, see WindowHandle().
    WindowHandles() (*WindowHandlesResponse, error)

    // SwitchToFrame switches to a frame determined by the "by" parameter.
    // You can use ByIndex to find the frame to switch to. Any other
    // By implementation will yield an InvalidByParameter error.
    SwitchToFrame(by By) (*SwitchToFrameResponse, error)

    // SwitchToParentFrame switches to the parent of the current top level
    // browsing context.
    SwitchToParentFrame() (*SwitchToParentFrameResponse, error)

    // WindowSize retrieves the current browser window size for the
    // active session.
    WindowSize() (*WindowSizeResponse, error)

    // SetWindowSize sets the current browser window size for the active
    // session.
    SetWindowSize(dimensions *Dimensions) (*SetWindowSizeResponse, error)

    // Maximize increases the current browser window to its maximum size.
    MaximizeWindow() (*MaximizeWindowResponse, error)

    // FindElement finds an element via a By implementation (i.e. CSS selector,
    // x-path). Attempting to find via index will result in an argument error
    // being thrown.
    FindElement(by By) (Element, error)

    // FindElements works the same way as FindElement but can return more than
    // one result.
    FindElements(by By) ([]Element, error)

    // PageSource retrieves the outerHTML value of the current URL.
    PageSource() (*PageSourceResponse, error)

    // ExecuteScript executes a Javascript script on the currently active
    // page.
    ExecuteScript(script string) (*ExecuteScriptResponse, error)

    // ExecuteScriptAsync executes a Javascript script asynchronously on the
    // currently active page. If you do not have experience with this call,
    // there is an example below.
    //
    // The async handler runs on the concept of a callback; meaning it will run
    // your code asynchronously and if it completes, will call the callback.
    //
    // Selenium helpfully provides a callback function which is passed in
    // to the 'arguments' array that you can access within your script. The
    // callback function is always the LAST element of the array. You can
    // access it like the below:
    //		var callback = arguments[arguments.length - 1];
    // The callback function also accepts one argument as a parameter, this
    // can be anything and will be assigned to the Response property of
    // ExecuteScriptResponse.
    //
    // An example:
    //		var callback = arguments[arguments.length - 1];
    //		doLongWindedTask();
    //		callback();
    ExecuteScriptAsync(script string) (*ExecuteScriptResponse, error)

    // AllCookies returns all cookies associated with the active URL of the
    // current browsing context.
    AllCookies() (*AllCookiesResponse, error)

    // Cookie gets a single named cookie associated with the active URL of the
    // current browsing context.
    Cookie(name string) (*CookieResponse, error)

    // AddCookie adds a cookie to the current browsing context.
    AddCookie(c *Cookie) (*AddCookieResponse, error)

    // DeleteCookie deletes a cookie from the current browsing session. If name
    // is passed as an empty string, all cookies for the current address will
    // be deleted.
    DeleteCookie(name string) (*DeleteCookieResponse, error)

    // DismissAlert dismisses an alert if there is one present. If not, it will
    // throw an error.
    DismissAlert() (*DismissAlertResponse, error)

    // AcceptAlertResponse accepts an alert if there is one present. If not,
    // it will throw an error.
    AcceptAlert() (*AcceptAlertResponse, error)

    // AlertText gets the text associated with the current alert. If there is
    // not an alert, it will throw an error.
    AlertText() (*AlertTextResponse, error)

    // SendAlertText enters the text specified into the value box.
    //
    // If the prompt is of type 'alert' or 'confirm', a communication error
    // with code 'element not interactable' will be returned.
    //
    // If the prompt is anything other than 'prompt', a communication error with
    // code 'unsupported operation' will be returned.
    SendAlertText(text string) (*SendAlertTextResponse, error)

    // Screenshot takes a screenshot of the window of the current top level
    // browsing context. The image returned will be a PNG image.
    Screenshot() (*ScreenshotResponse, error)

    // Wait repeats an action until the action yields a valid result or
    // until the timeout is reached. If the timeout is reached without
    // the until function returning a satisfactory result, this method
    // will return false.
    //
    // time.Sleep will be called with the sleep parameter after every
    // u iteration.
    Wait(u Until, timeout time.Duration, sleep time.Duration) bool
}

WebDriver is an interface which adheres to the W3C specification for WebDrivers (https://w3c.github.io/webdriver/webdriver-spec.html).

func NewSeleniumWebDriver Uses

func NewSeleniumWebDriver(serviceURL string, capabilities Capabilities) (WebDriver, error)

NewSeleniumWebDriver creates a new instance of a Selenium web driver with a service URL (usually http://domain:port/wd/hub) and a Capabilities object. This method will return validation errors if the Selenium URL is invalid or the required capabilities (BrowserName) are not set.

type WindowHandleResponse Uses

type WindowHandleResponse struct {
    State  string
    Handle string
}

WindowHandleResponse is the response returned from the WindowHandle() method. The handle is the current active window. Should you switch windows, any value returned prior to that call will be invalid.

type WindowHandlesResponse Uses

type WindowHandlesResponse struct {
    State   string   `json:"state"`
    Handles []string `json:"value"`
}

WindowHandlesResponse is the response returned from the WindowHandles() method. This is essentially an array of available window handlers that aren't necessarily active.

type WindowSizeResponse Uses

type WindowSizeResponse struct {
    State      string     `json:"state"`
    Dimensions Dimensions `json:"value"`
}

WindowSizeResponse is the response returned from calling the WindowSize method. The definitions are in CSS pixels.

Package goselenium imports 9 packages (graph) and is imported by 1 packages. Updated 2018-07-14. Refresh now. Tools for package owners.