web_driver_client v0.2.0 WebDriverClient View Source
Webdriver API client.
Link to this section Summary
Elements
Clears the value of a text input or text area element
Clicks an element
Fetches the currently active (focused) element
Fetches the value of an element's attribute
Sends a request to the server to see if an element is displayed
Fetches the value of an element's property
Fetches the visitble text of an element
Finds the first element using the given search strategy
Finds the elements using the given search strategy
Finds elements that are children of the given element
Sends a sequence of keystrokes to the currently active element.
Sends a sequence of keystrokes to an element
Alerts
Accepts the currently active alert dialog.
Dismisses the currently active alert dialog.
Fetches the text from the currently active alert.
Sends keystrokes to the currently active Javascript prompt dialog.
Functions
Deletes all cookies visible to the current page
Fetches all cookies visible to the current web page.
Fetches server status
Returns the size of the current window
Sets a cookie
Sets the size of the window
Takes a screenshot of the current page.
Link to this section Types
basic_reason()
View Sourcebasic_reason() :: WebDriverClient.ConnectionError.t() | WebDriverClient.UnexpectedResponseError.t() | WebDriverClient.WebDriverError.t()
element_location_strategy()
View Sourceelement_location_strategy() :: :css_selector | :xpath
key_code()
View Sourcekey_code() :: :null | :cancel | :help | :backspace | :tab | :clear | :return | :enter | :shift | :left_shift | :control | :left_control | :alt | :left_alt | :pause | :escape | :space | :page_up | :page_down | :end | :home | :left | :arrow_left | :up | :arrow_up | :right | :arrow_right | :down | :arrow_down | :insert | :delete | :semicolon | :equals | :numpad0 | :numpad1 | :numpad2 | :numpad3 | :numpad4 | :numpad5 | :numpad6 | :numpad7 | :numpad8 | :numpad9 | :multiply | :add | :separator | :subtract | :decimal | :divide | :f1 | :f2 | :f3 | :f4 | :f5 | :f6 | :f7 | :f8 | :f9 | :f10 | :f11 | :f12 | :meta | :command | :left_meta | :right_shift | :right_control | :right_alt | :right_meta | :numpad_page_up | :numpad_page_down | :numpad_end | :numpad_home | :numpad_left | :numpad_up | :numpad_right | :numpad_down | :numpad_insert | :numpad_delete
reason()
View Sourcereason() :: WebDriverClient.ProtocolMismatchError.t() | basic_reason()
set_cookie_opt()
View Sourceset_cookie_opt() :: {:domain, WebDriverClient.Cookie.domain()}
size_opt()
View Sourcesize_opt() :: {:width, pos_integer()} | {:height, pos_integer()}
Link to this section Sessions
end_session(session)
View Sourceend_session(WebDriverClient.Session.t()) :: :ok | {:error, reason()}
Ends a session
fetch_sessions(config)
View Sourcefetch_sessions(WebDriverClient.Config.t()) :: {:ok, [WebDriverClient.Session.t()]} | {:error, reason()}
Returns the list of sessions
start_session(config, payload)
View Sourcestart_session(WebDriverClient.Config.t(), map()) :: {:ok, WebDriverClient.Session.t()} | {:error, reason()}
Starts a new session
Link to this section Elements
clear_element(session, element)
View Sourceclear_element(WebDriverClient.Session.t(), WebDriverClient.Element.t()) :: :ok | {:error, reason()}
Clears the value of a text input or text area element
click_element(session, element)
View Sourceclick_element(WebDriverClient.Session.t(), WebDriverClient.Element.t()) :: :ok | {:error, reason()}
Clicks an element
fetch_active_element(session)
View Sourcefetch_active_element(WebDriverClient.Session.t()) :: {:ok, WebDriverClient.Element.t()} | {:error, reason()}
Fetches the currently active (focused) element
fetch_element_attribute(session, element, attribute_name)
View Sourcefetch_element_attribute( WebDriverClient.Session.t(), WebDriverClient.Element.t(), attribute_name() ) :: {:ok, String.t()} | {:error, reason()}
Fetches the value of an element's attribute
fetch_element_displayed(session, element)
View Sourcefetch_element_displayed( WebDriverClient.Session.t(), WebDriverClient.Element.t() ) :: {:ok, boolean()} | {:error, reason()}
Sends a request to the server to see if an element is displayed
fetch_element_property(session, element, property_name)
View Sourcefetch_element_property( WebDriverClient.Session.t(), WebDriverClient.Element.t(), property_name() ) :: {:ok, String.t()} | {:error, reason()}
Fetches the value of an element's property
Only supported using :w3c protocol.
fetch_element_text(session, element)
View Sourcefetch_element_text(WebDriverClient.Session.t(), WebDriverClient.Element.t()) :: {:ok, String.t()} | {:error, reason()}
Fetches the visitble text of an element
find_element(session, element_location_strategy, element_selector)
View Sourcefind_element( WebDriverClient.Session.t(), element_location_strategy(), element_selector() ) :: {:ok, WebDriverClient.Element.t()} | {:error, reason()}
Finds the first element using the given search strategy
If no element is found, a WebDriverClient.WebDriverError
is returned
find_elements(session, element_location_strategy, element_selector)
View Sourcefind_elements( WebDriverClient.Session.t(), element_location_strategy(), element_selector() ) :: {:ok, [WebDriverClient.Element.t()]} | {:error, reason()}
Finds the elements using the given search strategy
find_elements_from_element(session, element, element_location_strategy, element_selector)
View Sourcefind_elements_from_element( WebDriverClient.Session.t(), WebDriverClient.Element.t(), element_location_strategy(), element_selector() ) :: {:ok, [WebDriverClient.Element.t()] | {:error, reason()}}
Finds elements that are children of the given element
send_keys(session, keys)
View Sourcesend_keys(WebDriverClient.Session.t(), keys()) :: :ok | {:error, reason()}
Sends a sequence of keystrokes to the currently active element.
Only supported with :jwp protocol. Prefer send_keys_to_element/3 for
improved compatibility.
send_keys_to_element(session, element, keys)
View Sourcesend_keys_to_element( WebDriverClient.Session.t(), WebDriverClient.Element.t(), keys() ) :: :ok | {:error, reason()}
Sends a sequence of keystrokes to an element
Link to this section Alerts
accept_alert(session)
View Sourceaccept_alert(WebDriverClient.Session.t()) :: :ok | {:error, reason()}
Accepts the currently active alert dialog.
Usually this is the equivalent to clicking ok on a dialog.
dismiss_alert(session)
View Sourcedismiss_alert(WebDriverClient.Session.t()) :: :ok | {:error, reason()}
Dismisses the currently active alert dialog.
For confirm() and prompt() dialogs, this is equivalent to
clicking the 'Cancel' button. For alert() dialogs, this is
equivalent to clicking the 'OK' button.
fetch_alert_text(session)
View Sourcefetch_alert_text(WebDriverClient.Session.t()) :: :ok | {:error, reason()}
Fetches the text from the currently active alert.
send_alert_text(session, text)
View Sourcesend_alert_text(WebDriverClient.Session.t(), String.t()) :: :ok | {:error, reason()}
Sends keystrokes to the currently active Javascript prompt dialog.
Link to this section Logging
fetch_log_types(session)
View Sourcefetch_log_types(WebDriverClient.Session.t()) :: {:ok, [log_type()]} | {:error, reason()}
Fetches the log types from the server
fetch_logs(session, log_type)
View Sourcefetch_logs(WebDriverClient.Session.t(), log_type()) :: {:ok, [WebDriverClient.LogEntry.t()]} | {:error, reason()}
Fetches log entries for the requested log type.
Link to this section Functions
delete_cookies(session)
View Sourcedelete_cookies(WebDriverClient.Session.t()) :: :ok | {:error, reason()}
Deletes all cookies visible to the current page
fetch_cookies(session)
View Sourcefetch_cookies(WebDriverClient.Session.t()) :: {:ok, [WebDriverClient.Cookie.t()]} | {:error, reason()}
Fetches all cookies visible to the current web page.
fetch_server_status(config)
View Sourcefetch_server_status(WebDriverClient.Config.t()) :: {:ok, WebDriverClient.ServerStatus.t()} | {:error, reason()}
Fetches server status
fetch_window_size(session)
View Sourcefetch_window_size(WebDriverClient.Session.t()) :: {:ok, WebDriverClient.Size.t()} | {:error, reason()}
Returns the size of the current window
set_cookie(session, name, value, opts \\ [])
View Sourceset_cookie( WebDriverClient.Session.t(), WebDriverClient.Cookie.name(), WebDriverClient.Cookie.value(), [set_cookie_opt()] ) :: :ok | {:error, reason()}
Sets a cookie
set_window_size(session, opts \\ [])
View Sourceset_window_size(WebDriverClient.Session.t(), [size_opt()]) :: :ok | {:error, reason()}
Sets the size of the window
take_screenshot(session)
View Sourcetake_screenshot(WebDriverClient.Session.t()) :: {:ok, binary()} | {:error, reason()}
Takes a screenshot of the current page.