All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.screenplay.ensure.web.PageObjectEnsure.kt Maven / Gradle / Ivy

There is a newer version: 4.2.9
Show newest version
package net.serenitybdd.screenplay.ensure.web

import net.serenitybdd.screenplay.Actor
import net.serenitybdd.screenplay.abilities.BrowseTheWeb
import net.serenitybdd.screenplay.ensure.KnowableValue
import net.serenitybdd.screenplay.ensure.StringEnsure

class PageObjectEnsure() {

    fun title() : StringEnsure = StringEnsure(titleValue())
    fun currentUrl() : StringEnsure = StringEnsure(currentUrlValue())
    fun pageSource() : StringEnsure = StringEnsure(pageSourceValue())
    fun windowHandle() : StringEnsure = StringEnsure(windowHandleValue())

    private fun titleValue() : KnowableValue = fun(actor: Actor) : String = BrowseTheWeb.`as`(actor).title
    private fun currentUrlValue() : KnowableValue = fun(actor: Actor) : String = BrowseTheWeb.`as`(actor).driver.currentUrl
    private fun pageSourceValue() : KnowableValue = fun(actor: Actor) : String = BrowseTheWeb.`as`(actor).driver.pageSource
    private fun windowHandleValue() : KnowableValue = fun(actor: Actor) : String = BrowseTheWeb.`as`(actor).driver.windowHandle
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy