balin / com.github.epadronu.balin.core / JavaScriptSupport

JavaScriptSupport

interface JavaScriptSupport

Describes the js property support, which aims to ease the use of JavascriptExecutor.executeScript & JavascriptExecutor.executeAsyncScript.

Browser.drive(driverFactory = driverFactory) {
    // When I navigate to the Kotlin's page URL
    to("https://kotlinlang.org/")

    // And I execute JavaScript code with arguments via `invoke`
    val arguments = js(1.5, 2.3) {
        "return 'Arguments: ' + arguments[0] + ', ' + arguments[1];"
    }

    // Then I should get the arguments as is
    assertEquals(arguments, "Arguments: 1.5, 2.3")
}

Properties

js

abstract val js: JavaScriptExecutor

Allows the execution of synchronous and asynchronous JavaScript code if such functionality is supported by the underlying driver.

Inheritors

Browser

interface Browser : JavaScriptSupport, WaitingSupport, WebDriver

Balin's backbone. The Browser interface binds together the different abstractions that form part of the library.

Component

abstract class Component : ClickAndNavigateSupport, ComponentMappingSupport, JavaScriptSupport, SearchContext, WaitingSupport

A component is a reusable piece of functionality that can be shared among several pages, and which interaction can be performed independently of other pieces in the web page.

Page

abstract class Page : ClickAndNavigateSupport, ComponentMappingSupport, JavaScriptSupport, SearchContext, WaitingSupport

This class is the corner stone for Balin's implementation of the Page Object Design Pattern. All classes that model a Web page/view most extend this one.