open fun <T : Page> to(factory: (Browser) -> T): T
Navigates to the given page.
If the page has not defined a URL, then a MissingPageUrlException will be thrown immediately since is not possible to perform the navigation.
If the page defines an implicit at verification, then it will be invoked immediately. If such verification fails, Balin will throw a PageImplicitAtVerificationException in order to perform an early failure.
// Given the Kotlin's website index page URL
val indexPageUrl = "https://kotlinlang.org/"
Browser.drive(driverFactory) {
// When I visit such URL
// Then I should change the browser's URL to the given one
assertEquals(to(indexPageUrl), indexPageUrl)
// And I should get the title of the Kotlin's website index page
assertEquals(title, "Kotlin Programming Language")
}
factory
- provides an instance of the page given the driver being used by the browser.
MissingPageUrlException
- if the page has not defined a URL.
PageImplicitAtVerificationException
- if the page has an implicit at verification which have failed.
Returns
An instance of the current page.
See Also
org.openqa.selenium.WebDriver.get
open fun to(url: String): String
Navigates to the given URL.
url
- the URL the browser will navigate to.
Return
The browser's current URL.
See Also