TucoTuco.DSL
SourceSummary
accept_alert(f) | Accept an alert that comes up |
accept_prompt(text, f) | Accept a prompt and fill it in with the text given |
alert_text() | Return the text contained in an alert |
current_host() | Returns the host part of the current url |
current_path() | Returns the path portion of the current url |
current_port() | Returns the port part of the current url |
current_query() | Returns the query portion of the current url |
current_session() | Returns the name or pid of the current TucoTuco session |
current_url() | Returns the current url as a string |
dismiss_confirm(f) | Dismiss a confirmation dialog. This is the equivalent to clicking on what is usually the Cancel button |
execute_async_javascript(script, arguments \\ []) | Executes javascript in the page. This executes the javascript asynchronously and returns when the callback is called which will be injected as the last argument to the function |
execute_javascript(script, arguments \\ []) | Executes javascript in the page |
go_back() | Send the browser backward in history |
go_forward() | Send the browser forward in history |
has_alert?() | True or false depending on if a prompt, alert or confirm dialog is currently open on the page |
save_screenshot(file_path) | Saves a PNG screenshot at the path specified.
Returns |
visit(url) | Send the browser to the specified url |
Functions
Accept an alert that comes up.
Note that alerts, prompts and dialogs will prevent interaction with
the page whilst they are open so any actions that open one
must be wrapped in an accept_alert
, accept_prompt
or dismiss_confirm
call.
Example:
accept_alert fn ->
click("Show Alert")
end
Accept a prompt and fill it in with the text given.
Example:
accept_prompt "Elixir is Great", fn ->
click_link("Prompt me")
end
Return the text contained in an alert.
Example:
accept_alert fn ->
click("Show Alert")
assert "this is an alert" = alert_text
end
Dismiss a confirmation dialog. This is the equivalent to clicking on what is usually the Cancel button.
Example:
dismiss_confirm fn ->
click("Show Confirmation")
end
Executes javascript in the page. This executes the javascript asynchronously and returns when the callback is called which will be injected as the last argument to the function.
Executes javascript in the page.
The arguments can be referred to in the script by referencing
the Javascript array called arguments
.
Return values can be:
* :null
* A number.
* A string.
* A WebDriver.Element struct.
* A tuple list (Javacript object.)
* A list of any of these.
Example:
```
assert "Hello World" == execute_javascript("return argument[0] + argument[1]", ["Hello","World"])
```
True or false depending on if a prompt, alert or confirm dialog is currently open on the page.
Saves a PNG screenshot at the path specified.
Returns :ok
if successful or {:error, reason}
if there
is an error.