balin / com.github.epadronu.balin.core / JavaScriptExecutor / get

get

open operator fun get(value: String): Any?

Get the value of a global-JavaScript variable.

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

    // And I set a global variable
    js["myGlobal"] = "super global variable"

    // And I retrieve such global variable via a `get` call
    val globalVariableValue = js["myGlobal"]

    // Then I should get the variable's value as is
    assertEquals(globalVariableValue, "super global variable")
}

Parameters

value - the name of the variable which value will be retrieved.

Return
One of Boolean, Long, Double, String, List, Map or WebElement. Or null.