Skip to content
Kotlin DSL for Selenium. Provide a possibility to write tests in Kotlin type-safe builders style
Branch: master
Clone or download
Latest commit 90f6493 Apr 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src some fixes Mar 12, 2018
.gitignore fixes WebDriverWait builder Jul 2, 2017
LICENSE Create LICENSE Apr 13, 2018
README.md Update README.md Feb 15, 2018
pom.xml some fixes Mar 11, 2018

README.md

SeleniumBuilder

DSL for Selenium. Provide a possibility to write tests in Kotlin type-safe builders style

Sample

driver(ChromeDriver()) { 
    get("http://cool-website.com")
    
    elementByClass("login") {
        sendKeys("user@example.com")
    }

    elementByName("password") {
        sendKeys("123456")
        submit()
    }
    
    element(By.className("search")) {
        sendKeys("kotlin")
    }
    
    wait(10) {
        elementVisibilityById("result-item") {
            elementByClass("salary") {
                item.salary = text
            }
        }
    }
}

Total function list

Driver builders

driver(driver: WebDriver) {}

chromeDriver {}

chromeDriver(pathToDriver: String) {}

firefoxDriver {}

firefoxDriver(pathToDriver: String) {}

WebDriver and WebElement element builders

element(by: By) {}

elementById(id: String) {}

elementByClass(className: String) {}

elementByName(name: String) {}

elementBySelector(selector: String) {}

elementByXpath(selector: String) {}

WebDriver and WebElement element list builders

elements(by: By) {}

elementsById(id: String) {}

elementsByClass(className: String) {}

elementsByName(name: String) {}

elementsBySelector(selector: String) {}

elementsByXpath(selector: String) {}

WebDriver and WebElement element exists functions

elementExists(by: By): Boolean

elementByIdExists(id: String): Boolean

elementByClassExists(className: String): Boolean

elementByNameExists(name: String): Boolean

elementBySelectorExists(selector: String): Boolean

elementByXpathExists(selector: String): Boolean

WebDriver WebDriverWait builder

wait(timeout: Long) {}

WebDriverWait element visibility builders

elementVisibility(by: By) {}

elementVisibilityById(id: String) {}

elementVisibilityByClass(className: String) {}

elementVisibilityByName(name: String) {}

elementVisibilityBySelector(selector: String) {}

elementVisibilityByXpath(xpath: String) {}

WebDriverWait element invisibility functions

elementInvisibility(by: By): Boolean

elementInvisibilityById(id: String): Boolean

elementInvisibilityByClass(className: String): Boolean

elementInvisibilityByName(name: String): Boolean

elementInvisibilityBySelector(selector: String): Boolean

elementInvisibilityByXpath(xpath: String): Boolean

You can’t perform that action at this time.