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

org.xpathqs.driver.extensions.SelectorExtensions.kt Maven / Gradle / Ivy

There is a newer version: 0.0.9
Show newest version
package org.xpathqs.driver.extensions

import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.driver.actions.*
import org.xpathqs.driver.const.Global
import java.time.Duration

val  T.isVisible: Boolean
    get() = Global.executor.isPresent(this)

val  T.isHidden: Boolean
    get() = !isVisible

fun  T.waitForVisible(duration: Duration = Global.WAIT_FOR_ELEMENT_TIMEOUT) {
    Global.executor.execute(WaitForSelectorAction(this, duration))
}

fun  T.waitForDisappear(duration: Duration = Global.WAIT_FOR_ELEMENT_TIMEOUT) {
    Global.executor.execute(WaitForSelectorDisappearAction(this, duration))
}

fun  T.click(): T {
    Global.executor.execute(ClickAction(this))
    return this
}

fun  T.input(value: String): T {
    Global.executor.execute(InputAction(value, this))
    return this
}

fun  T.clear(): T {
    Global.executor.execute(ClearAction(this))
    return this
}

val  T.text: String
    get() = getAttr(Global.TEXT_ARG)

fun  T.getAttr(name: String) =
    Global.executor.getAttr(this, name)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy