interface Browser : JavaScriptSupport, WaitingSupport, WebDriver
Balin's backbone. The Browser
interface binds together the different
abstractions that form part of the library.
Additionally, this interface defines the entry point for the Domain-Specific Language which Balin is built around.
abstract val configurationSetup: ConfigurationSetup
The configuration setup used to customized Balin's behavior. |
|
abstract val driver: WebDriver
The driver to be used when evaluating |
|
abstract val js: JavaScriptExecutor
Allows the execution of synchronous and asynchronous JavaScript code if such functionality is supported by the underlying driver. |
open fun <T : Page> at(factory: (Browser) -> T): T
Tells the browser at what page it should be located. |
|
open fun <T : Page> to(factory: (Browser) -> T): T
Navigates to the given page. open fun to(url: String): String
Navigates to the given URL. |
open fun <T> waitFor(timeOutInSeconds: Long = configurationSetup.waitForTimeOutTimeInSeconds, sleepInMillis: Long = configurationSetup.waitForSleepTimeInMilliseconds, isTrue: () -> ExpectedCondition<T>): T
Repeatedly applies the underlying driver to the given function until one of the following occurs: |
fun configure(block: ConfigurationBuilder.() -> Unit): Unit
Domain-Specific language that let's you configure Balin's global behavior. |
|
fun drive(driverFactory: () -> WebDriver = desiredConfiguration.driverFactory, autoQuit: Boolean = desiredConfiguration.autoQuit, block: Browser.() -> Unit): Unit fun drive(configuration: Configuration, block: Browser.() -> Unit): Unit
This method represents the entry point for the Domain-Specific Language which Balin is built around. |
fun SearchContext.$(selector: String, index: Int): WebElement
Find the nth element that can be located by the given CSS selector. fun SearchContext.$(selector: String, range: IntRange): List<WebElement>
Find all the elements that can be located by the given CSS selector, restricted by the specified range. fun SearchContext.$(selector: String, vararg indices: Int): List<WebElement>
Find all the elements that can be located by the given CSS selector, restricted by the specified indices. (If no index is provided, then all matching elements will be returned.) |
|
fun SearchContext.find(selector: String, index: Int): WebElement
Find the nth element that can be located by the given CSS selector. fun SearchContext.find(selector: String, range: IntRange): List<WebElement>
Find all the elements that can be located by the given CSS selector, restricted by the specified range. fun SearchContext.find(selector: String, vararg indices: Int): List<WebElement>
Find all the elements that can be located by the given CSS selector, restricted by the specified indices. (If no index is provided, then all matching elements will be returned.) |
|
fun Browser.withAlert(alertContext: Alert.() -> Unit): Unit
Switches to the currently active modal dialog for this particular driver instance. |
|
fun Browser.withFrame(index: Int, iFrameContext: () -> Unit): Unit fun <T : Page> Browser.withFrame(index: Int, iFrameContext: T.() -> Unit): Unit
Select a frame by its (zero-based) index and switch the driver's context to it. fun Browser.withFrame(nameOrId: String, iFrameContext: () -> Unit): Unit fun <T : Page> Browser.withFrame(nameOrId: String, iFrameContext: T.() -> Unit): Unit
Select a frame by its name or ID. Frames located by matching name attributes are always given precedence over those matched by ID. fun Browser.withFrame(webElement: WebElement, iFrameContext: () -> Unit): Unit fun <T : Page> Browser.withFrame(webElement: WebElement, iFrameContext: T.() -> Unit): Unit
Select a frame using its previously located WebElement. |
|
fun Browser.withWindow(nameOrHandle: String? = null, windowContext: WebDriver.() -> Unit): Unit
Switch the focus of future commands for this driver to the window with the given name/handle. |