module Stoertebeker::DSL

Included Modules

Direct including types

Defined in:

stoertebeker/dsl.cr

Instance Method Summary

Instance Method Detail

def click(selector) #

Simulates a click on an element identified by the passed selector. If the selector matches multiple elements, an error is raised.


[View source]
def current_path #

Returns the path of the currently displayed website.


[View source]
def current_url #

Returns the url of the currently displayed website.


[View source]
def evaluate(script) #

Executes javascript and returns the resulting value (JSON).


[View source]
def execute(*args) #

Runs javascript without returning a value.


[View source]
def execute(*args, &block : JSON::Any -> ) #

Runs the passed javascript and invokes the block with the output of the javascript (JSON).


[View source]
def exists?(selector) #

Returns true if the selector matches anything on the currently displayed website. The call does not wait for the element to show up, it checks the DOM immediately.


[View source]
def inner_html(selector) #

Returns the innerHTML of an element matched by the selector.


[View source]
def page_title #

Returns the title of the DOM of the currently displayed website.


[View source]
def ping #

Used to check whether the server responds


[View source]
def quit(*args) #

Terminates the electron server.


[View source]
def request(*args) #

Instructs electron to load a website:

request("http://localhost:3001/example.html")

[View source]
def screenshot(*args) #

Saves a screenshot of the currently displayed website.

screenshot("./temp/example2.png")

[View source]
def set_value(selector, value) #

Sets the value of an input element, e.g. a text field.

set_value(".textfield", "somevalue")

[View source]
def wait_for(*args, **kwargs) #

Waits for an element to be present.#

tries: the number of times the selector will be queried for (default 10) delay: the delay between each try in ms (default 20)

wait_for("h1#example1", tries: 5, delay: 20)

[View source]
def window(**args) #

Sets the window width and height

window(width: 1024, height: 768)

[View source]