API

Public

WebDriver.CapabilitiesType
Capabilities(browserName::AbstractString;
             browserVersion::AbstractString = "",
             platformName::AbstractString = "",
             acceptInsecureCerts::Union{Nothing, Bool} = nothing,
             pageLoadStrategy::AbstractString = "",
             proxy::Union{Nothing, Proxy} = nothing,
             setWindowRect::Union{Nothing, Bool} = nothing,
             timeouts::Timeouts = Timeouts(),
             strictFileInteractability::Union{Nothing, Bool} = nothing,
             unhandledPromptBehavior::AbstractString = "dismiss and notify"
             )::Capabilities

According to W3C.

Example

julia> capabilities = Capabilities("chrome")
Remote WebDriver Capabilities
browserName: chrome
source
WebDriver.CookieType
Cookie(obj)::Cookie
Cookie(name::AbstractString, value;
       path::AbstractString = "/",
       domain::Union{Nothing, AbstractString} = nothing,
       secure::Bool = false,
       httpOnly::Bool = false,
       expiry::Union{Nothing, Integer, DateTime} = nothing)::Cookie

A cookie per W3C.

source
WebDriver.ElementType
Element(session::Session, location_strategy::AbstractString, value::AbstractString)::Element
Element(element::Element, location_strategy::AbstractString, value::AbstractString)::Element

The Find Element command is used to find an element in the current browsing context that can be used as the web element context for future element-centric commands.

May use a location strategy from "css selector", "link text", "partial link text", "tag name" or "xpath".

julia> capabilities = Capabilities("chrome")
Remote WebDriver Capabilities
browserName: chrome
julia> wd = RemoteWebDriver(capabilities, host = ENV["WEBDRIVER_HOST"], port = parse(Int, ENV["WEBDRIVER_PORT"]))
Remote WebDriver
julia> session = Session(wd)
Session
julia> isa(session, Session)
true
julia> delete!(session);
source
WebDriver.ProxyType
Proxy(proxyType::AbstractString;
      proxyAutoconfigUrl::Union{Nothing, AbstractString} = nothing,
      ftpProxy::Union{Nothing, AbstractString} = nothing,
      httpProxy::Union{Nothing, AbstractString} = nothing,
      noProxy::Union{Nothing, AbstractVector{<:AbstractString}} = nothing,
      sslProxy::Union{Nothing, AbstractString} = nothing,
      socksProxy::Union{Nothing, AbstractString} = nothing,
      socksVersion::Union{Nothing, Integer} = nothing)::Proxy

The proxy configuration capability is a JSON Object nested within the primary capabilities. According to the W3C.

source
WebDriver.RemoteWebDriverType
RemoteWebDriver(capabilities::Capabilities;
                host::AbstractString = "localhost",
                port::Integer = 4444,
                path::AbstractString = "/wd/hub",
				kwargs...)::RemoteWebDriver

Specifies a remote web driver according to W3C.

julia> capabilities = Capabilities("chrome")
Remote WebDriver Capabilities
browserName: chrome
julia> wd = RemoteWebDriver(capabilities, host = ENV["WEBDRIVER_HOST"], port = parse(Int, ENV["WEBDRIVER_PORT"]))
Remote WebDriver
julia> status(wd) # Ready to accept new sessions?
true
source
WebDriver.SessionType
Session

This is a web session.

julia> capabilities = Capabilities("chrome")
Remote WebDriver Capabilities
browserName: chrome
julia> wd = RemoteWebDriver(capabilities, host = ENV["WEBDRIVER_HOST"], port = parse(Int, ENV["WEBDRIVER_PORT"]))
Remote WebDriver
julia> session = Session(wd)
Session
julia> isa(session, Session)
true
julia> delete!(session);
source
WebDriver.TimeoutsType
Timeouts

According to the W3C.

julia> Timeouts(script = 50_000, pageLoad = 100_000, implicit = 5)
Session Timeouts -- script: 50000, pageLoad: 100000, implicit: 5
source
Base.delete!Method
delete!(session::Session, cookie::AbstractString)::Nothing

If cookie = "", delete all cookies. Otherwise, delete cookie matching the "cookie" name.

source
Base.delete!Method
delete!(session::Session)

Deletes the session from the Remote Driver.

source
WebDriver.ElementsMethod
Elements(element::Element, location_strategy::AbstractString, value::AbstractString)::Vector{Element}

Find Elements

See also: Element

source
WebDriver.ElementsMethod
Elements(session::Session, location_strategy::AbstractString, value::AbstractString)::Vector{Element}

Find Elements

See also: Element

source
WebDriver.acceptMethod
accept(session::Session)::Nothing

Accepts the currently displayed alert dialog.

Note

This command uses the JSON Wire Protocol instead of the current W3c WebDriver API.

source
WebDriver.alert_text!Method
alert_text!(session::Session, text::AbstractString)::Nothing

Sends keystrokes to a JavaScript prompt() dialog.

Note

This command uses the JSON Wire Protocol instead of the current W3c WebDriver API.

source
WebDriver.alert_textMethod
alert_text(session::Session)::String

Gets the text of the currently displayed JavaScript alert(), confirm(), or prompt() dialog.

Note

This command uses the JSON Wire Protocol instead of the current W3c WebDriver API.

source
WebDriver.back!Method
back!(session::Session)

This command causes the browser to traverse one step backward in the joint session history of the current top-level browsing context. This is equivalent to pressing the back button in the browser chrome or invoking window.history.back.

source
WebDriver.click!Method
click!(element::Element)::Nothing

The Element Click command scrolls into view the element if it is not already pointer-interactable, and clicks its in-view center point. If the element’s center point is obscured by another element, an element click intercepted error is returned. If the element is outside the viewport, an element not interactable error is returned.

source
WebDriver.cookiesMethod
cookies(session::Session)::Vector{Cookie}

The Get Page Source command returns a string serialization of the DOM of the current browsing context active document.

source
WebDriver.dismissMethod
dismiss(session::Session)::Nothing

Dismisses the currently displayed alert dialog.

Note

This command uses the JSON Wire Protocol instead of the current W3c WebDriver API.

source
WebDriver.document_titleMethod
document_title(session::Session)::String

This command returns the document title of the current top-level browsing context, equivalent to calling document.title.

source
WebDriver.element_keys!Method
clear!(element::Element)::Nothing

The Element Send Keys command scrolls into view the form control element and then sends the provided keys to the element. In case the element is not keyboard-interactable, an element not interactable error is returned.

Note

Keyboard keys are not implemented yet.

source
WebDriver.element_textMethod
element_text(element::Element)::String

The Get Element Text command intends to return an element’s text "as rendered". An element's rendered text is also used for locating a elements by their link text and partial link text.

source
WebDriver.forward!Method
forward!(session::Session)

This command causes the browser to traverse one step forwards in the joint session history of the current top-level browsing context.

source
WebDriver.frame!Function
frame!(frame::Element)::Nothing

The Switch To Frame command is used to select the current top-level browsing context or a child browsing context of the current browsing context to use as the current browsing context for subsequent commands.

source
WebDriver.isselectedMethod
isselected(element::Element)::Bool

The Is Element Selected command determines if the referenced element is selected or not. This operation only makes sense on input elements of the Checkbox and Radio Button states, or on option elements.

source
WebDriver.maximize!Method
maximize!(session::Session; window::AbstractString = "current")::Dict{String,Int}

The Maximize Window command 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.

Note

This command is implemented using the JSON Wire Protocol.

source
WebDriver.minimize!Method
minimize!(session::Session; window::AbstractString = "current")::NamedTuple{(:width, :height, :x, :y),NTuple{4,Int64}}

The Minimize Window command 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.

Note

This command is implemented using the JSON Wire Protocol.

source
WebDriver.moveto!Method
moveto!(session::Session; x::Integer = 0, y::Integer = 0)
moveto!(element::Element; x::Integer = 0, y::Integer = 0)

Move the mouse by an offset of the specificed element.

Note

This command uses the JSON Wire Protocol instead of the current W3c WebDriver API.

source
WebDriver.navigate!Method
navigate!(session::Session, url::AbstractString)

The command causes the user agent to navigate the current top-level browsing context to a new location.

source
WebDriver.parent_frame!Method
parent_frame!(session::Session)::Nothing

The Switch to Parent Frame command sets the current browsing context for future commands to the parent of the current browsing context.

source
WebDriver.rectFunction
rect(session::Session; window::AbstractString = "current")::NamedTuple{(:width, :height, :x, :y),NTuple{4,Int64}}

The Get Window Rect command returns the size and position on the screen of the operating system window corresponding to the current top-level browsing context.

source
WebDriver.rect!Method
rect!(session::Session;
      window::AbstractString = "current",
      width::Union{Nothing, Real} = nothing,
      height::Union{Nothing, Real} = nothing
     )::NamedTuple{(:width, :height, :x, :y),NTuple{4,Int64}}

The Set Window Rect command alters the size and the position of the operating system window corresponding to the current top-level browsing context.

source
WebDriver.rectMethod
rect(element::Element)::NamedTuple{(:width, :height, :x, :y),NTuple{4,Int64}}

The Get Element Rect command returns the dimensions and coordinates of the given web element. The returned value is a dictionary with the following members:

  • x: X axis position of the top-left corner of the web element relative to the current browsing context’s document element in CSS pixels.
  • y: Y axis position of the top-left corner of the web element relative to the current browsing context’s document element in CSS pixels.
  • height: Height of the web element’s bounding rectangle in CSS pixels.
  • width: Width of the web element’s bounding rectangle in CSS pixels.
source
WebDriver.refresh!Method
refresh!(session::Session)

This command causes the browser to reload the page in the current top-level browsing context.

source
WebDriver.screenshotFunction
screenshot(session::Session)::String
screenshot(element::Element)::String
screenshot(source::Union{Session, Element}, sink::Union{AbstractString, IO})

Take Screenshot and optionally saves it.

source
WebDriver.script!Method
script!(session::Session, script::AbstractString, args...; async::Bool = false)

Executes JavaScript (sync / async)

Note

This command uses the JSON Wire Protocol instead of the current W3c WebDriver API.

source
WebDriver.sessionsMethod
sessions(wd::RemoteWebDriver)

Returns a list of the currently active sessions.

Note

This is a JSON Wire Protocol functionality.

source
WebDriver.sourceMethod
source(session::Session)::String

The Get Page Source command returns a string serialization of the DOM of the current browsing context active document.

source
WebDriver.statusMethod
status(wd::WebDriver)::Bool

Returns true if the server is running and ready to accept new sessions.

source
WebDriver.window!Method
window!(session::Session, handle::AbstractString)

The window handle associated with the current top-level browsing context.

source
WebDriver.window_close!Method
window_close!(session::Session)::Nothing

The window handle associated with the current top-level browsing context.

source
WebDriver.window_handleMethod
window_handle(session::Session)::String

The window handle associated with the current top-level browsing context.

source
WebDriver.window_handlesMethod
window_handles(session::Session)::Vector{String}

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.

source

Private