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

org.pojosontheweb.selenium.groovy.WebDriverCategory.groovy Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
package org.pojosontheweb.selenium.groovy

import com.pojosontheweb.selenium.Findr
import static com.pojosontheweb.selenium.Findr.logDebug
import org.openqa.selenium.Dimension
import org.openqa.selenium.JavascriptExecutor
import org.openqa.selenium.WebDriver

@Category(WebDriver)
class WebDriverCategory {

    Findr getFindr() {
        return new Findr(this)
    }

    void setWindowSize(Dimension d) {
        manage().window().setSize(d)
    }

    def executeJavaScript(String javascript, Object[] args) {
        ((JavascriptExecutor)this).executeScript(javascript, args)
    }

    def executeJavaScript(String javascript) {
        ((JavascriptExecutor)this).executeScript(javascript, new Object[0])
    }

    def withQuit(Closure c) {
        try {
            c()
        } finally {
            logDebug("[WebDriverCategory] quit WebDriver $this")
            quit()
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy